feat: Added ball and collision to paddles. Added a score system and timer for game. May be done in one day.
This commit is contained in:
+15
-6
@@ -9,19 +9,28 @@ struct Point {
|
||||
Point();
|
||||
Point(int row, int col) : m_row(row), m_col(col) {};
|
||||
void to_string();
|
||||
void to_string(int index);
|
||||
void clear(std::array<std::array<char, COL>, ROW> &m_board);
|
||||
// void set_new_point(int row, int col);
|
||||
void assign(int row, int col);
|
||||
};
|
||||
|
||||
struct Ball {
|
||||
Ball();
|
||||
Point m_origin;
|
||||
int m_vx = 1;
|
||||
int m_vy = -1;
|
||||
bool m_goal;
|
||||
void get_new_pos();
|
||||
void check_collision();
|
||||
void change_direction(char d);
|
||||
};
|
||||
|
||||
struct Paddle {
|
||||
Paddle(int col);
|
||||
int _size;
|
||||
int m_score;
|
||||
Point m_nodes[4];
|
||||
void get_new_pos(int col);
|
||||
};
|
||||
|
||||
struct Ball {
|
||||
|
||||
void check_collision(Ball &ball);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user