Skip to content

Commit

Permalink
feat: add dog bark voice (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarekkkkk authored Dec 13, 2024
2 parents 639f879 + 13515cc commit 0f4c8e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Binary file added apps/pwa/public/dog-bark-voice.mp3
Binary file not shown.
7 changes: 5 additions & 2 deletions apps/pwa/src/routes/fomo-game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default function FomoGame() {
const gravity = 0.9;
const bounceVelocity = 15; // Upward velocity during bounce
const [isRotating, setIsRotating] = useState(false);
console.log("isShowMint", isShowMint);
const voice = new Audio("/dog-bark-voice.mp3");

useEffect(() => {
let motionListener: any;
if (isRunning) {
Expand All @@ -104,6 +105,7 @@ export default function FomoGame() {
velocity.current = bounceVelocity;
lastBounceTime.current = currentTime;
setScore((prev) => prev + 1);
voice.play();
}
};

Expand Down Expand Up @@ -163,7 +165,7 @@ export default function FomoGame() {
}, [isRunning, timeLeft]);

const startGame = () => {
setTimeLeft(5);
setTimeLeft(15);
setScore(0); // Reset score
setPosition(0); // Reset ball position
velocity.current = 0; // Reset velocity
Expand Down Expand Up @@ -230,6 +232,7 @@ export default function FomoGame() {
<Button className="mx-auto mt-4" onClick={startGame}>
Start
</Button>
<Button className="mx-auto mt-4">Bark</Button>
<div className="absolute bottom-10 h-40 w-40">
<WoodenFishIcon className="h-full w-full fill-white" />
</div>
Expand Down

0 comments on commit 0f4c8e3

Please sign in to comment.