diff --git a/du4 /snake.c b/du4 /snake.c index 9743fd5..881f20b 100644 --- a/du4 /snake.c +++ b/du4 /snake.c @@ -79,7 +79,7 @@ int is_snake(struct snake* snake,int x,int y){ FAZY: 1. -> Kontrola kolizie (seba + vs. stien) 2. -> Kontrola logiky zobratia jedla (resp. kolizie s jedlom, update statusu, pripadny narast hada) 3. -> Realizacia pohybu - 4. -> finalna kontrola poctu jedla*/ + 4. -> finalna kontrola poctu jedla */ int step_state(struct state* st){ int nx = (st->snake->x + st->sx); int ny = (st->snake->y + st->sy); @@ -112,9 +112,11 @@ int step_state(struct state* st){ st->foodx[i] = -1; st->foody[i] = -1; - add_snake(st->snake; nx, ny); + add_snake(st->snake, nx, ny); hasEatenFoodinThisCycle = true; + + break; } //hra bude pokracovat normalne dalej, ak NIE JE vsetko jedlo zobrate if (st->foodx[i] != -1) @@ -123,7 +125,7 @@ int step_state(struct state* st){ } } - //normalny pohyb snake-a (ak jedlo nebolo zjedene) + //normalny pohyb snake-a (ak jedlo nebolo zjedene v tomto update cykle) if (!hasEatenFoodinThisCycle) { st->snake = add_snake(st->snake, nx, ny);