Files
proyectos-en-sdl2/snake2/game.hpp
Daniel Cortes 242e60ff40 Initial commit
2020-05-22 01:54:52 -04:00

64 lines
890 B
C++
Executable File

#ifndef GAME_H
#define GAME_H
#include <list>
enum Direction { DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT };
class Food
{
private:
int max_x;
int max_y;
public:
int x;
int y;
Food();
Food(int max_x, int max_y);
void relocate();
};
struct Body
{
int x;
int y;
};
class Snake
{
public:
Direction last_direction;
Direction direction;
std::list<Body> body;
bool alive;
Snake();
Snake(int start_x, int start_y);
void move();
void turn(Direction direction);
void eat();
};
class Game
{
public:
Snake snake;
Food food;
int tiles_x;
int tiles_y;
int dificulty_multiplier;
int points;
Game(int tiles_x, int tiles_y);
void update();
void reset();
};
#endif