Remove mouse input, fix sound only play on "start"

This commit is contained in:
Stephen Seo 2023-05-09 15:51:20 +09:00
parent 3dfa30ca97
commit ae8c7daf7d
2 changed files with 14 additions and 12 deletions

View file

@ -363,12 +363,14 @@ impl Music {
}
pub fn damaged(&self) {
crate::tone(
Pitch::D5.to_u32() | (Pitch::D1.to_u32() << 16),
30 << 8,
60,
TONE_NOISE,
)
if self.started {
crate::tone(
Pitch::D5.to_u32() | (Pitch::D1.to_u32() << 16),
30 << 8,
60,
TONE_NOISE,
)
}
}
fn get_factor(&self) -> f32 {

View file

@ -230,7 +230,7 @@ impl World {
}
}
if (gamepad & crate::BUTTON_1) != 0 || (mouse & crate::MOUSE_LEFT) != 0 {
if (gamepad & crate::BUTTON_1) != 0 {
self.rand.next_u16();
if self.is_in_range {
self.is_in_range = false;
@ -369,11 +369,11 @@ impl World {
if let Some((_, Building::WrongHouse, _)) = self.building {
crate::text("Don't Press!", 5, 10);
} else if let Some((_, Building::SpeedUp, _)) = self.building {
crate::text("Tap or Press X?", 5, 10);
crate::text(b"Press \x80?", 5, 10);
} else if let Some((_, Building::SlowDown, _)) = self.building {
crate::text("Tap or Press X?", 5, 10);
crate::text(b"Press \x80?", 5, 10);
} else {
crate::text("Tap or Press X!", 5, 10);
crate::text(b"Press \x80!", 5, 10);
}
}
@ -419,7 +419,7 @@ impl World {
crate::text("GAME OVER", 40, 40);
crate::text("Score:", 50, 50);
crate::custom_text(self.score_buf, width, 70 - (width / 2) as i32 * 8, 60);
crate::text("Press Z to restart", 10, 70);
crate::text(b"Press \x81 to restart", 10, 70);
}
} else {
if self.lives > 0 {
@ -428,7 +428,7 @@ impl World {
crate::text("GAME OVER", 40, 40);
crate::text("Score:", 50, 50);
crate::text("99999999999999", 70 - 7 * 8, 60);
crate::text("Press Z to restart", 10, 70);
crate::text(b"Press \x81 to restart", 10, 70);
}
}
}