feat: added blocks. Forgot basics of looping arrays in process and cried

This commit is contained in:
DarthMooMancer
2025-09-01 04:41:38 -04:00
parent 0fc5a08ab2
commit 702be0363f
5 changed files with 86 additions and 20 deletions
+20 -12
View File
@@ -1,6 +1,8 @@
#ifndef ELEMENTS_HPP
#define ELEMENTS_HPP
#include <string>
struct Point {
Point();
int m_row;
@@ -9,25 +11,31 @@ struct Point {
void to_string();
};
struct Paddle {
Paddle();
int _size;
Point m_nodes[3];
void get_new_pos();
};
struct Ball {
Ball();
Point m_origin;
int vx;
int vy;
void get_new_pos();
void check_collision();
void check_collision(int &lives);
void change_velocity(char d);
};
// struct Block {
//
// };
//
struct Paddle {
Paddle();
int _size;
Point m_nodes[3];
void get_new_pos();
void check_collision(Ball &ball);
};
struct Block {
Block(char symbol, int row, int col);
int _size;
char m_symbol;
Point m_nodes[3];
void get_pos();
void check_collision(Ball &ball);
};
#endif
+2 -1
View File
@@ -7,6 +7,7 @@
struct Window {
std::array<std::array<char, COL>, ROW> m_board = {};
void update_display(Paddle &paddle, Ball &ball);
void update_display(Paddle &paddle, Ball &ball, Block (&block_list)[15]);
void tick(int fps);
};
#endif