mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Snake: Clear the movement queue on game reset.
This commit is contained in:
parent
b41e95b578
commit
09c087177c
Notes:
sideshowbarker
2024-07-19 14:39:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/09c087177c5
@ -14,6 +14,12 @@ public:
|
||||
m_elements[i] = T();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_head = 0;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
bool is_empty() const { return !m_size; }
|
||||
int size() const { return m_size; }
|
||||
|
||||
|
@ -19,6 +19,7 @@ void SnakeGame::reset()
|
||||
m_head = { m_rows / 2, m_columns / 2 };
|
||||
m_tail.clear_with_capacity();
|
||||
m_length = 2;
|
||||
m_velocity_queue.clear();
|
||||
stop_timer();
|
||||
start_timer(120);
|
||||
spawn_fruit();
|
||||
|
Loading…
Reference in New Issue
Block a user