refactor: renamed snake to element and moved fruit to element. Removed a lot of unused functions and variables
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifndef ELEMENT_HPP
|
||||
#define ELEMENT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "point.hpp"
|
||||
|
||||
struct Head {
|
||||
Head();
|
||||
Point m_head;
|
||||
Point m_previous_head;
|
||||
void get_new_pos();
|
||||
};
|
||||
|
||||
struct Tail {
|
||||
Point m_tail_pos;
|
||||
Point m_previous_tail_pos;
|
||||
};
|
||||
|
||||
struct Body {
|
||||
Body();
|
||||
std::vector<Tail> m_body;
|
||||
int m_score;
|
||||
bool m_collision;
|
||||
void clear(std::array<std::array<char, COL>, ROW> &arr);
|
||||
void add_tail();
|
||||
void get_new_points(Head &head);
|
||||
void collision(Head &head);
|
||||
};
|
||||
|
||||
struct Fruit {
|
||||
Fruit();
|
||||
Point m_point;
|
||||
void get_new_pos(std::array<std::array<char, COL>, ROW> &board, Head &head, int &score);
|
||||
};
|
||||
|
||||
#endif // ELEMENT_HPP
|
||||
Reference in New Issue
Block a user