snake new control: don't allow snake to go to opposite direction
This commit is contained in:
parent
782c0f4439
commit
12db75f1b1
|
@ -62,6 +62,10 @@ void snake_game() {
|
||||||
#ifdef GAME_SNAKE_NEWCONTROL
|
#ifdef GAME_SNAKE_NEWCONTROL
|
||||||
if (joy_cmd != 0xff)
|
if (joy_cmd != 0xff)
|
||||||
{
|
{
|
||||||
|
if ( (dir == left && joy_cmd != right) ||
|
||||||
|
(dir == right && joy_cmd != left) ||
|
||||||
|
(dir == up && joy_cmd != down) ||
|
||||||
|
(dir == down && joy_cmd != up) )
|
||||||
dir = joy_cmd;
|
dir = joy_cmd;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue