feat: (snake) collision with head and body
This commit is contained in:
+2
-2
@@ -2,9 +2,9 @@
|
||||
#define INPUT_HPP
|
||||
|
||||
struct Input {
|
||||
char m_current_key = ' ';
|
||||
int m_current_key = 0;
|
||||
char m_getch = ' ';
|
||||
void get_input(int &d, bool &r);
|
||||
void get_input(int &d, bool &c, bool &r);
|
||||
};
|
||||
|
||||
#endif // INPUT_HPP
|
||||
|
||||
@@ -26,6 +26,7 @@ struct Body {
|
||||
void draw(std::array<std::array<char, COL>, ROW> &arr);
|
||||
void move(Head &head);
|
||||
void get_new_points(Head &head);
|
||||
void collision(Head &head, bool &running);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+3
-2
@@ -12,12 +12,13 @@ struct Window {
|
||||
int m_reset;
|
||||
int m_previous_reset;
|
||||
|
||||
void draw_score();
|
||||
void draw_window();
|
||||
void clear_window();
|
||||
void tick(double frames_per_second);
|
||||
void kill(bool &running);
|
||||
void update_score(Fruit &fruit, Body &body);
|
||||
void update_loop(int fps);
|
||||
void update_display(int fps);
|
||||
void check_exit(bool &running, Body &body, bool &collision);
|
||||
};
|
||||
|
||||
#endif // WINDOW_HPP
|
||||
|
||||
Reference in New Issue
Block a user