fix: (tail) fixed where tail index 0 is on top of the head

This commit is contained in:
DarthMooMancer
2025-08-28 20:14:35 -04:00
parent ac23c873c3
commit 157933c122
9 changed files with 86 additions and 84 deletions
+11
View File
@@ -8,6 +8,8 @@ Window::Window() {
row.fill('.');
}
m_score = 0;
m_reset = 0;
m_previous_reset = 0;
}
void Window::draw_score() {
@@ -23,6 +25,15 @@ void Window::draw_window() {
std::cout << std::flush;
}
void Window::update_score(Fruit &fruit, Body &body) {
if(m_score % 1 == 0 && m_score >= 1) {
fruit.m_total_eaten++;
m_score = 0;
body.m_body.push_back(Tail{2, 0, 0});
}
}
void Window::clear_window() {
std::cout<<"\033[H" << std::flush;
}