feat: added blocks. Forgot basics of looping arrays in process and cried
This commit is contained in:
+20
-12
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user