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:
DarthMooMancer
2025-08-30 22:41:39 -04:00
parent fe8e4346a2
commit fbdf7af31e
9 changed files with 138 additions and 44 deletions
+15 -6
View File
@@ -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