How could you implement automatic taps?

Hello

How would you implement automatic tapping of a button that's located in the same position throughout the whole title?

It would be a feature where the player would physically tap once on a button, and then the automatic tapping feature will constantly tap on an X/Y location on the grid until user taps the screen or the game finishes and loops back to the main menu.

Ideally, this code should run it's course throughout the whole game, including all the scenes.
If tapping speed could be varied depending on what setting was selected, that'd be great.
But for now, I'd like for this action to scroll through all the scenes "as fast as possible without breaking the game".

Any ideas?

Thanks

Comments

  • TheGabfatherTheGabfather Member Posts: 633
    edited October 2013
    You can always use a Timer (you can create your own if you feel like it'll improve performance) and a couple of Rules that check for the initial tap which fires the Timer to execute (1), and the second tap or end of game (2).

    I'm still not clear about the location of your buttons and their relation with the X/Y on the grid you're talking about, but you might also need to take note of those two and save them somewhere globally if you're working with multiple scenes, or local to the scene if it's a single scene game (3) -- this should help you if you have varied points the user can tap on.

    Timers, whether the default one or a custom made one will have to rely on a certain measure of time or ticks before executing. You can use a custom attribute and just have your Timers rely on that value for various tapping speeds (4).

    If you can wait, there will be an upcoming feature for the stable releases, which is the implementation of Loops. This should prove to be more flexible, lighter (I think), etc.
    It's available in the Nightly Builds right now for Pro users.

    I hope I understood your question :)
  • vivi03vivi03 Member Posts: 6
    Hello TheGabfather

    Thank you for your response. I'm currently researching Timers and it seems I should be able to utilize this feature.

    However, I can't seem to find a behavior that will mimic a "tap/touch".

    I think I would be able to figure out how to do this if I knew precisely what value change occurs when a user touches the screen.

    The bottom line is, automation aside, I can't figure out how to tap one location, and have the title register the tap on a different part of the screen.

    Upon researching, there are functions that will let you move actors to where you actually tap, but not "leave the actor alone, but trigger the tap motion on it; even if tapping somewhere else"

    Once I do that, I should be able to use timers.

    Thanks for the help
  • TheGabfatherTheGabfather Member Posts: 633
    @vivi03
    I'm still confused with your explanation. Can you provide a sketch or screenshot/reference so the picture (i.e. the idea) will be clear to me?

    By the way if you want to Spawn an Actor at a certain location on screen and have it remain there, you can just Spawn it through the Rule "when Actor receives event > touch > is pressed" (e.g. on an Actor that spans the entire screen), Spawn at location game.Mouse.Position.X and game.Mouse.Position.Y.

    Keep in mind that when you Spawn something it will be a Prototype version of that Actor and would not be able to access Scene-specific Attributes.
  • vivi03vivi03 Member Posts: 6
    edited October 2013
    Hello TheGabfather

    Thanks again for your response.
    I've drafted up a sketch that (hopefully) makes the concept make a bit more sense.

    Since I couldn't upload a picture to the forums, here's a link to my dropbox.
    image

    The functionality I'm looking for is the game to "mimic somebody touching the screen"
    Similar to those automatic mouse clickers that people who want to cheat in PC games use.
    Or in other words, implementing a Homer's drinking bird per say...

    Think there's something in GS that can do this?

    Thanks


  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited October 2013
    By the way, heres the code to post pics on the forum, <!img src="Put your picture link here" />
    just remove the explanation mark at the beginning
    and it will work ;)
  • vivi03vivi03 Member Posts: 6
    Thanks for that tip!
    *Updated post*
  • TheGabfatherTheGabfather Member Posts: 633
    edited October 2013
    @vivi03
    Ah I get it now. Technically speaking you can't do a "phantom touch" (or, "automatic touch") in GS. I don't even know how to do that in C++.

    But there are a couple of ways to cheat this in Gamesalad.

    Here's a simple way to achieve that:

    Create a custom Boolean Game Attribute. This will be Global and accessible by Actors at any given Scene.

    A tap at "Special Button" should toggle this Boolean Attribute and switch Scene X to Scene X+1.

    Then just have all succeeding scenes' buttons have a Rule that when your custom Boolean Game Attribute is set to True (or False -- it's up to you), then execute the action (i.e. Change Scene). This will happen automatic and Scene changes will take place instantly, so you might want to put a delay in there and maybe include some button press animations. You can use a Timer Group/Behaviour for this and just set it to "After." Alternatively, you can create your own version of a Timer.

    You can also make use of Spawning Invisible Actors and using the Collide or Overlap Rules with the Scenes' Buttons. But the above method should work just fine.

    It's by no means the best method though.

    edit: Might I just suggest though, that you look into Single Scene Games. If you can fashion your game Scene (or even including the menu!) to run in a single Scene, your user experience would be miles better, compared to changing Scenes at every tap. The load scenes, no matter how brief, can be irritating at times for some people.
Sign In or Register to comment.