wip
This commit is contained in:
+4
-24
@@ -1,7 +1,6 @@
|
||||
#ifndef ELEMENT_HPP
|
||||
#define ELEMENT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "globals.hpp"
|
||||
|
||||
static int _score = 0;
|
||||
@@ -11,7 +10,7 @@ struct Point {
|
||||
int m_col;
|
||||
char m_symbol;
|
||||
int m_direction;
|
||||
Point() : m_row(0), m_col(0), m_symbol(' ') {}
|
||||
Point() : m_row(0), m_col(0), m_symbol('@') {}
|
||||
Point(int x, int y, char s) : m_row(x), m_col(y), m_symbol(s) {}
|
||||
Point(int x, int y, char s, int d) : m_row(x), m_col(y), m_symbol(s), m_direction(d) {}
|
||||
void to_string();
|
||||
@@ -19,33 +18,14 @@ struct Point {
|
||||
};
|
||||
|
||||
void determine_index_zero_pos(Point* (*board)[COL], Point** segments);
|
||||
bool check_new_tail(Point** segments);
|
||||
void move_tail_indicies(Point** segments);
|
||||
|
||||
struct Head {
|
||||
Head() : m_direction(2) {};
|
||||
Point m_head {5, 5, '*'};
|
||||
Point m_previous_head;
|
||||
int m_direction;
|
||||
void get_new_pos();
|
||||
};
|
||||
|
||||
struct Tail {
|
||||
Point m_tail_pos {0, 0, '@'};
|
||||
Point m_previous_tail_pos;
|
||||
};
|
||||
|
||||
struct Body {
|
||||
std::vector<Tail> m_body;
|
||||
void check_new_tail();
|
||||
bool check_collision(Head &head);
|
||||
void get_new_pos(Head &head);
|
||||
};
|
||||
void input_new_tail(Point *(*board)[10], Point** segments);
|
||||
void on_fruit_eaten(Point* (*board)[COL], Point** segments);
|
||||
|
||||
struct Fruit {
|
||||
Fruit();
|
||||
Point m_point {0, 0, 'o'};
|
||||
void get_new_pos(char (&board)[ROW][COL], Head &head);
|
||||
void on_fruit_eaten(Point* (*board)[COL], Point** segments);
|
||||
};
|
||||
|
||||
#endif // ELEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user