2023-10-29 23:14:51 +03:00
|
|
|
#ifndef __PLAYER_H__
|
|
|
|
#define __PLAYER_H__
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2023-10-30 01:55:20 +03:00
|
|
|
#include "food.h"
|
2023-10-29 23:14:51 +03:00
|
|
|
|
2023-11-24 22:14:53 +03:00
|
|
|
typedef enum { UP, RIGHT, DOWN, LEFT} Direction;
|
2023-10-29 23:14:51 +03:00
|
|
|
typedef struct player_node_t PlayerNode;
|
|
|
|
typedef struct player_t Player;
|
|
|
|
|
|
|
|
struct player_node_t
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
PlayerNode *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct player_t
|
|
|
|
{
|
|
|
|
PlayerNode *tail, *head;
|
|
|
|
Direction direction;
|
|
|
|
int score;
|
|
|
|
};
|
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
void playerCreate(Player *buffer, Direction direction, int x, int y, int score);
|
2023-10-29 23:14:51 +03:00
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
bool playerCheckSelfCollision(Player player);
|
|
|
|
bool playerCheckFoodCollision(Player player, Food food);
|
2023-10-30 01:55:20 +03:00
|
|
|
bool playerDoTick(Player *player, Food food);
|
2023-10-29 23:14:51 +03:00
|
|
|
|
|
|
|
#endif /* __PLAYER_H__ */
|