diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2020-01-14 00:45:30 +0000 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2020-01-14 00:45:30 +0000 |
commit | aac221043fe706ccdc5638db3631e89d2818b3bc (patch) | |
tree | df29b1e58ec8efd192e1f5502867ebd8374cd2f2 | |
parent | added highscore (diff) | |
download | csnake-aac221043fe706ccdc5638db3631e89d2818b3bc.tar.gz csnake-aac221043fe706ccdc5638db3631e89d2818b3bc.tar.bz2 csnake-aac221043fe706ccdc5638db3631e89d2818b3bc.zip |
fixed a buggy bug (try and collide into itslef left to right stops it)
-rwxr-xr-x | a.out | bin | 18080 -> 18080 bytes | |||
-rw-r--r-- | es.s | 0 | ||||
-rw-r--r-- | snake.c | 14 |
3 files changed, 13 insertions, 1 deletions
diff --git a/a.out b/a.out index 64451ea..bc257a0 100755 --- a/a.out +++ b/a.out Binary files differdiff --git a/es.s b/es.s new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/es.s diff --git a/snake.c b/snake.c index 2ea8847..8569498 100644 --- a/snake.c +++ b/snake.c @@ -214,7 +214,10 @@ void move_left(LinkedList* snake, int* new, int* status) { /* You cant move left if youre going right */ if(*status == 1) + { + move_right(snake, new, status); return; + } int tmp[2]; int prev[2]; @@ -229,7 +232,10 @@ void move_left(LinkedList* snake, int* new, int* status) void move_right(LinkedList* snake, int* new, int* status) { if(*status == 0) + { + move_left(snake, new, status); return; + } int tmp[2]; int prev[2]; @@ -244,8 +250,11 @@ void move_right(LinkedList* snake, int* new, int* status) void move_up(LinkedList* snake, int* new, int* status) { if(*status == 3) + { + move_down(snake, new, status); return; - int tmp[2]; + } + int tmp[2]; int prev[2]; *(prev + 0) = snake->head->x; @@ -259,7 +268,10 @@ void move_up(LinkedList* snake, int* new, int* status) void move_down(LinkedList* snake, int* new, int* status) { if(*status == 2) + { + move_up(snake, new, status); return; + } int tmp[2]; int prev[2]; |