fix health reset on feeding
This commit is contained in:
parent
3a163fd6e7
commit
d858d88e76
@ -458,12 +458,12 @@ impl Snake {
|
|||||||
pub fn advance(&mut self, head: Coord) {
|
pub fn advance(&mut self, head: Coord) {
|
||||||
self.body.push_back(head);
|
self.body.push_back(head);
|
||||||
self.body.pop_front();
|
self.body.pop_front();
|
||||||
self.health = 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn feed(&mut self) {
|
pub fn feed(&mut self) {
|
||||||
if let Some(tail) = self.body.front() {
|
if let Some(tail) = self.body.front() {
|
||||||
self.body.push_front(*tail);
|
self.body.push_front(*tail);
|
||||||
|
self.health = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user