fix: (tail) fixed where tail index 0 is on top of the head
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user