Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Swipe to Move an Actor Help

I followed the tutorial on how to set up swipe controls to move an actor Left, Right, Up, Down and got it to work, but there is something more that I want set up that I don't know how to do. The current set up allows me to freely change directions every time I swipe in a new direction, so if I am moving down I can swipe again and change directions before ever reaching the boundaries of the bottom screen. For the game I am making, I want to hinder that free-movement by only allowing the player to move in a new direction after the actor has finished moving in the first direction chosen, by colliding with a wall or object. For instance, I slide to move a box down and it slides across the floor (as if on ice) until it hits a wall and stops. Now that it has stopped, I can choose a new direction to send it sliding in, rather than being able to change directions mid-slide like it is set up now. Any help in setting up this control system will be greatly appreciated!

For reference, here is that tutorial:


  • allc1865allc1865 Posts: 777Member, PRO
    Is this your question: how to make a character stop sliding when you move him right or left and then let go of that control?
  • allc1865allc1865 Posts: 777Member, PRO
    Oh I see. You want to know how to stop the sliding movement when you stop swiping left or right?
  • mfieldgamesmfieldgames Posts: 2Member
    edited October 2013
    Not quite. Sorry this is difficult to explain how this works. The way the controls are set up now from that tutorial, I can slide the mouse in different directions to keep changing to a different direction, so I can just dodge around all the obstacles. I want there to be a rule that makes it so once a player slides their finger to move in a direction, they can't slide in a new direction to move until the first direction they chose has finished executing.

    By finished executing, I mean the actor (in this case, a box sliding on ice) slides across the screen until it collides with a wall or another box, thus stopping it. Now that it has stopped moving, the player may once again choose a direction to slide the box in. The point is to create puzzles that require a specific path the player must slide the box in, in order to reach a goal.

    With the current controls, I can bypass this puzzle path by spam-sliding the mouse to slide straight to the goal, without ever having to stop moving or collide with a wall or other obstacle. This is obviously game breaking. I hope this explanation makes more sense, and thanks again for any help!
  • tatiangtatiang Posts: 11,639Member, Sous Chef, PRO, Senior Sous-Chef
    Sounds like you just need a boolean called game.AllowSwipe that starts out true and gets set to false once a swipe is detected and then set to true once a collision occurs. Add the condition When attribute game.AllowSwipe = true to your swipe detection rule.

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

  • hairykiwishairykiwis Posts: 4Member

    @allc1865 said:
    Is this your question: how to make a character stop sliding when you move him right or left and then let go of that control?

    any way to do this ? my actor keeps sliding till I tap again to stop it.

Sign In or Register to comment.