Snake Game - using Keyboard sensor to switch on a direction?

Hey. I’m trying to work towards a snake game, but im running into a problem already.
I want the arrow keys to switch the "snake"s direction, but the way it’s set up now, it only moves in that direction while the key is held down.
Is there a way to set up a system where the tap of a key changes the variables so that it continues in that direction until a new key is pressed?

Thanks and here’s my .blend which should explain alot of what i’m talking about:
snake game.blend (84.4 KB)

Hey,
I made this quick example for you.
Hope it helps.
CGI

Attachments

Snake Movement.blend (142 KB)

awesome, that helps thanks.
i was hoping i could just store the direction in a variable but this works too.

i ended up just accessing the property through python.
here’s my working example for posterity’s sake:
snap move test1.blend (85 KB)

glad i could help.
good luck.
although, how are you going to keep your guy from going off the map?