From aac221043fe706ccdc5638db3631e89d2818b3bc Mon Sep 17 00:00:00 2001 From: Manuel Palenzuela Date: Tue, 14 Jan 2020 00:45:30 +0000 Subject: fixed a buggy bug (try and collide into itslef left to right stops it) --- a.out | Bin 18080 -> 18080 bytes es.s | 0 snake.c | 14 +++++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 es.s diff --git a/a.out b/a.out index 64451ea..bc257a0 100755 Binary files a/a.out and b/a.out differ diff --git a/es.s b/es.s new file mode 100644 index 0000000..e69de29 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]; -- cgit 1.4.1