Key up events with multiple keys
Posted: Fri Jan 25, 2013 2:24 am
I have a top-down view for my game and I'm trying to create 2D unit movement. I want to have 8 directions, so the unit would move diagonally when two non-opposing direction keys are pressed. Upon key up, the unit stops moving and remains facing the direction it was moving in.
The issue occurs during the key up event, where GE only allows a single key to be defined for this event. So if my unit is moving towards the top-right, I cannot leave it facing that direction when I stop pressing the keys. The unit ends up picking between the right and the top keys to determine the final position. Is there some way by which I can direct the actor to switch to the top-right animation stop position in such a case?
Also, if my actor is travelling at an angle (up and right together for example) and I release the "up" key so that only the "right" key is pressed, the animation does not change to that for movement towards the right. Instead, the key up animation for the up key gets frozen instead. Is there a way to work around this as well?
The issue occurs during the key up event, where GE only allows a single key to be defined for this event. So if my unit is moving towards the top-right, I cannot leave it facing that direction when I stop pressing the keys. The unit ends up picking between the right and the top keys to determine the final position. Is there some way by which I can direct the actor to switch to the top-right animation stop position in such a case?
Also, if my actor is travelling at an angle (up and right together for example) and I release the "up" key so that only the "right" key is pressed, the animation does not change to that for movement towards the right. Instead, the key up animation for the up key gets frozen instead. Is there a way to work around this as well?