Page 1 of 1

can I stop actor from going at an angle?

PostPosted: Thu Sep 07, 2006 5:52 am
by ericdg
I have an actor that goes in 4 directions with left, right, up, and down.

When I press up and right it goes in a north east direction. I was thinking of only using 4 directions instead of 8, If I wanted to do this how would I stop it from going at an angle?

PostPosted: Thu Sep 07, 2006 1:46 pm
by makslane
If you want to stop the actor when press two keys, just put an action to cancel the move done.

For example, if you use the key right to make 'x += 5;' and the key up to make 'y -= 5;' to cancel the diagonal move, just use a new 'Key Down' event for both up and right keys (with 'All keys are pressed' option) and put:

Code: Select all
x -= 5;
y += 5;