diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2020-01-09 17:20:39 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2020-01-09 17:20:39 +0100 |
commit | 43a66df282347b078970707bbb56f388c50df7fb (patch) | |
tree | 1ed5bd1d1662601c247586c04ac9bd7d14841715 | |
parent | initial commit (diff) | |
download | csnake-43a66df282347b078970707bbb56f388c50df7fb.tar.gz csnake-43a66df282347b078970707bbb56f388c50df7fb.tar.bz2 csnake-43a66df282347b078970707bbb56f388c50df7fb.zip |
start fixing collisions
-rwxr-xr-x | a.out | bin | 17912 -> 17912 bytes | |||
-rw-r--r-- | snake.c | 13 |
2 files changed, 8 insertions, 5 deletions
diff --git a/a.out b/a.out index e502c3e..049d5ff 100755 --- a/a.out +++ b/a.out Binary files differdiff --git a/snake.c b/snake.c index cb95844..a274e1c 100644 --- a/snake.c +++ b/snake.c @@ -43,8 +43,8 @@ int main() time = stats[0]; score = stats[1]; win = stats[2]; - - getch(); /* Wait for user input */ + + getch(); endwin(); printf("Time: %d\n", time); printf("Score: %d\n", score); @@ -62,7 +62,10 @@ void playGame(LinkedList* snake, int* apple, int* stats) { clear(); printw("Update %d", i); - if(i < 7) + move_up(snake); + move_right(snake); + move_down(snake); + /*if(i < 7) move_up(snake); else if(i < 12) move_left(snake); @@ -70,9 +73,8 @@ void playGame(LinkedList* snake, int* apple, int* stats) move_down(snake); else move_right(snake); - + */ drawSnake(snake, apple); - refresh(); switch(check_collision(snake, apple)) { //apple @@ -95,6 +97,7 @@ void playGame(LinkedList* snake, int* apple, int* stats) default: break; } + refresh(); usleep(50000); //usleep(1000000 / fps); i++; |