]> git.seodisparate.com - LD53/commitdiff
Remove mouse input, fix sound only play on "start"
authorStephen Seo <seo.disparate@gmail.com>
Tue, 9 May 2023 06:51:20 +0000 (15:51 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 9 May 2023 06:51:20 +0000 (15:51 +0900)
src/music.rs
src/world.rs

index 6e783a19b7d9dc37393feb2fd2db0c88a7131eb0..3d94d71e65db9138b409c7838aea9033eba04d68 100644 (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 {
index 1001981875a48f3c06f28f735b61bc415b75e5bf..f3e1c0031c4c604097029823fdc851665b14af48 100644 (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);
             }
         }
     }