Swipe to Move an Actor Question

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. 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 moves until it hits a wall and stops. Now that it has stopped, I can choose a new direction to send it in, rather than being able to change directions mid-move like it is set up now. Any help in setting up this control system will be greatly appreciated!

For reference, here is that tutorial:

Answers

  • BellowBellow Bartender Member, PRO Posts: 227
    try this. this is the first thing i come up with maybe there is better ideas :)

    create game attribute name stop real.
    put rule for movement : when move change att stop to 1
    make another rule when collide with wall (or whatever you want to stop)
    change att stop to 0

    then put this if att stop = 0 for your movements. I am not good teacher sorry :D
  • mfieldgamesmfieldgames Member Posts: 2
    try this. this is the first thing i come up with maybe there is better ideas :)

    create game attribute name stop real.
    put rule for movement : when move change att stop to 1
    make another rule when collide with wall (or whatever you want to stop)
    change att stop to 0

    then put this if att stop = 0 for your movements. I am not good teacher sorry :D
    I appreciate the help Bellow, but I am not exactly sure how to implement your solution. I created the attribute, but I'm not sure where to place the attribute Stop since the movement is set up as a Change Velocity rule, and not one of the Move or Move To behaviors. I tried plugging it in with those rules to see if it would work, but I was still able to change directions before ever hitting a wall or object. Thanks again for trying, sorry if I am misunderstanding your solution!
Sign In or Register to comment.