GameSalad

Issue with multiple keys being pressed

imjustmikeimjustmike Posts: 450Member, BASIC

Hey guys,

I'm controlling an actor using key input (left button down makes actor go left etc) - I'll eventually replace these with on screen buttons but I'm pretty sure this issue will still arise.

Essentially, I when left button is down, my actor goes left, when right is down he goes right. When neither is down, he stops. All working fine.

I want the player to be able to quickly change direction, so if they're pressing left, but then press right, right will take over and change the direction. For some reason, this only works one way.

If I'm holding down left, the actor moves left. If I keep holding down left and press right, he goes right. If I then release right, whilst left is still down, he goes back left. Perfect.

However, when I press right, he moves right, but pressing left he just keeps going right. The rules are the same for both buttons, so not sure what's going on.

If anyone can figure it out I'd be very grateful. I've posted my behaviours below - the trigger movement behaviour is for something else and isn't interfering. Also, I've tried this with nested rules as shown, and with the rules separated out, so that's not it.

image

Comments

Sign In or Register to comment.