Tap To Move Help

I am having a slight problem with a Tap To Move. I have the tap to move working well, however I need some help with making my object (actor) respond to only one tap at a time. I have an indicator spawn where the player tapped and then the actor moves to where the device is touched. I also have it so that the indicator spawns an invisible actor so that the moving actor still knows where to go after the indicator is gone. I need a way for my moving actor to go to only one point at a time. If you tap a different space before the moving actor gets to the original it goes there, and then stops. I need a way for it to go to the original spot and if the user taps the screen again while the moving actor is in motion nothing happens.

Any help would be awesome. Thanks

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Create a boolean game.StillMoving and change it to true when the player is moving. When the player stops moving, change it to false.

    Then only allow a new point to be chosen when game.StillMoving is false.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • kew709kew709 Member Posts: 10
    I have tried a similar way. However, since the actor moves based on touch, I have the actors movement as follows...

    when game movement = 1

    move to ... position h (game.Touches.Touch 1.X)
    position v (game. Touches.Touch 1.Y)

    i also have a rotate but thats not important right now. To reset the game movement back to 0 or false I have it collide with an invisible actor when it gets to the point. However when the user touches it before going to the first point it goes to the other point which is not marked on the screen and the moving actor will go there instead of the original point and then not move anymore.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    So I don't think you understood my suggestion. You have a rule that allows the player to change the destination point using touch... just enable that rule only when game.movement=1 or game.StillMoving is false, or however you decide to do it. You can even check the actor's velocity as a condition for that rule. If you force the actor to only change destinations when certain conditions are true, you alleviate the problem you're having.

    If it's still not making sense, consider posting a video of what is happening and/or a screenshot of your rules.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • kew709kew709 Member Posts: 10
    It make sense it just doesn't work. I think its because its set to move to detect every single touch and it goes to where you touch not to where the tag actor is. If there was a way to move to the invisible actor that spawns where the player touches that would do the trick I think
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Ah, okay. Instead of moving the actor when the screen is tapped, you need to set the destination position when the screen is tapped, and then only move the actor to that position when it is at a stand still. I'll see if I can create a demo for you.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2013
    Here you go:

    The only thing that doesn't work is if you click while the actor is moving and expect the actor to then move to that destination after it reaches its current destination.

    But I'm not sure what you're intending...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • kew709kew709 Member Posts: 10
    Thanks for that. I will check it out my university's mac lab tomorrow. I don't have the latest mac because mine is old. Thanks for the time and I will post results tomorrow morning
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2013
    If it helps, here are the rules:

    (The Move To behavior uses game.destinationX and game.destinationY, both real attributes.)

    image

    image

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • kew709kew709 Member Posts: 10
    It works great so far. Thank you so much for this. I knew I was close, but I just didn't know how to get it to recognize the ship was still moving.
Sign In or Register to comment.