Improvements
This commit is contained in:
parent
93171a5123
commit
a00e39e3f5
|
@ -108,9 +108,11 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
for c in scene.characters() {
|
for c in scene.characters() {
|
||||||
|
if c.is_alive() {
|
||||||
self.draw(c);
|
self.draw(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Triggers the display.
|
/// Triggers the display.
|
||||||
pub fn display(&mut self) {
|
pub fn display(&mut self) {
|
||||||
|
|
|
@ -89,6 +89,10 @@ impl Scene {
|
||||||
let mut state = State::Finished;
|
let mut state = State::Finished;
|
||||||
|
|
||||||
for c in &mut self.characters {
|
for c in &mut self.characters {
|
||||||
|
|
||||||
|
// Don't need to update if the character is dead
|
||||||
|
if c.is_alive() {
|
||||||
|
|
||||||
let old = c.bbox();
|
let old = c.bbox();
|
||||||
|
|
||||||
// Compute the offset between position and bbox
|
// Compute the offset between position and bbox
|
||||||
|
@ -112,9 +116,12 @@ impl Scene {
|
||||||
c.fall_off();
|
c.fall_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.controls().is_some() && c.is_alive() {
|
// If a character is alive and still have controls, the game should continue
|
||||||
|
if c.controls().is_some() {
|
||||||
state = State::Running;
|
state = State::Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
Loading…
Reference in New Issue