can I stop actor from going at an angle?

Non-platform specific questions.

can I stop actor from going at an angle?

Postby ericdg » Thu Sep 07, 2006 5:52 am

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?
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score

Postby makslane » Thu Sep 07, 2006 1:46 pm

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;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest