33 lines
752 B
C
33 lines
752 B
C
#include "snake.h"
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
struct snake* add_snake(struct snake* snake,int x,int y){
|
|
|
|
struct snake* nova_hlava = malloc(sizeof(struct snake)); //vytvorim novu hlavu na ktoru nalinkujem staru hlavu ako telo
|
|
|
|
nova_hlava -> x = x;
|
|
nova_hlava -> y = y; //zapisem suradnice novej hlavy do novej struktury
|
|
nova_hlava -> next = snake; //dalsi segment (next) je stara hlava zo vstupu funkcie
|
|
|
|
return nova_hlava;
|
|
}
|
|
|
|
struct snake* remove_snake(struct snake* snake){
|
|
return NULL;
|
|
}
|
|
|
|
void free_snake(struct snake* sn){
|
|
}
|
|
|
|
int is_snake(struct snake* snake,int x,int y){
|
|
return 0;
|
|
}
|
|
|
|
int step_state(struct state* st){
|
|
int nx = (st->snake->x + st->sx);
|
|
int ny = (st->snake->y + st->sy);
|
|
return END_CONTINUE;
|
|
}
|