rayflap

A Flappy Bird clone written in C and compiled to WebAssembly.
git clone https://unitehenry.com/git/rayflap.git
Log | Files | Refs | README

commit 54eb1667825d755d229e781c3bd7e42edb83b714
parent 455cec4e2da42faa28a12e3037c1ad321660ba89
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 19 Apr 2026 18:14:37 +0000

feat: hit sound

Diffstat:
Msrc/game.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/game.c b/src/game.c @@ -26,6 +26,8 @@ Texture2D scoreTexture[10]; /* Sounds */ Sound pointSound; +Sound hitSound; +Sound wingSound; /* Game State */ typedef enum { TITLE, PLAY } Screen; @@ -55,12 +57,17 @@ void init_audio() { InitAudioDevice(); pointSound = LoadSound("assets/audio/point.ogg"); + hitSound = LoadSound("assets/audio/hit.ogg"); + wingSound = LoadSound("assets/audio/wing.ogg"); } void play_sound(Sound sound) { if (!IsSoundValid(sound)) return; + if (isPaused) + return; + PlaySound(sound); } @@ -348,6 +355,7 @@ void collide() { Rectangle baseRect = baseRects[i]; if (CheckCollisionRecs(birdRect, baseRect)) { + play_sound(hitSound); isPaused = true; } } @@ -356,6 +364,7 @@ void collide() { Rectangle pipeRect = pipeRects[i]; if (CheckCollisionRecs(birdRect, pipeRect)) { + play_sound(hitSound); isPaused = true; } }