diff --git a/asset-src/gfx/attack.piskel b/asset-src/gfx/attack.piskel new file mode 100644 index 0000000..63265bd --- /dev/null +++ b/asset-src/gfx/attack.piskel @@ -0,0 +1 @@ +{"modelVersion":2,"piskel":{"name":"attack","description":"","fps":12,"height":10,"width":32,"layers":["{\"name\":\"Layer 1\",\"opacity\":1,\"frameCount\":1,\"chunks\":[{\"layout\":[[0]],\"base64PNG\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAKCAYAAADVTVykAAAAS0lEQVQ4jWNgIBP8/////9y5c/8jA1x8cu3AsJAYy4jhU2QxpZaTFDK0tBwGGFycnP7jwrS2fHA4YMCjYFAnQnwOoVs2xOcgavgUABeOG1DJQNZ1AAAAAElFTkSuQmCC\"}]}"],"hiddenFrames":[]}} \ No newline at end of file diff --git a/assets/gfx/attack.png b/assets/gfx/attack.png new file mode 100644 index 0000000..13f384e Binary files /dev/null and b/assets/gfx/attack.png differ diff --git a/assets/sfx/boing.wav b/assets/sfx/boing.wav deleted file mode 100644 index b07fc96..0000000 Binary files a/assets/sfx/boing.wav and /dev/null differ diff --git a/assets/sfx/feather.wav b/assets/sfx/feather.wav new file mode 100644 index 0000000..44b0e91 Binary files /dev/null and b/assets/sfx/feather.wav differ diff --git a/assets/sfx/hit.wav b/assets/sfx/hit.wav new file mode 100644 index 0000000..6146c98 Binary files /dev/null and b/assets/sfx/hit.wav differ diff --git a/src/Credits.c b/src/Credits.c index 3720a59..72d2eb9 100644 --- a/src/Credits.c +++ b/src/Credits.c @@ -22,8 +22,8 @@ void DrawCreditsScreen(void) DrawTexture(background, 0, 0, DARKGRAY); DrawText("CREDITS", 290, 20, 50, BLUE); DrawText("Programming and Art by Return0ne", 10, 210, 20, BLUE); - DrawText("Powered by raylib 4.0", 10, 240, 20, BLUE); + DrawText("Powered by raylib 4.0 and rFXgen for sound effects", 10, 240, 20, BLUE); DrawText("A Canneddonuts project 2022", 10, 270, 40, BLUE); - DrawText(TextFormat("Build compiled on %s", __DATE__), 10, 310, 30, YELLOW); + DrawText(TextFormat("Build compiled on %s", __DATE__), 10, 310, 30, GREEN); DrawText("Press 'ENTER' ", 10, 350, 20, WHITE); } diff --git a/src/Gameplay.c b/src/Gameplay.c index 902ebd4..0b70c76 100644 --- a/src/Gameplay.c +++ b/src/Gameplay.c @@ -19,10 +19,9 @@ int score = 0, bestscore = 0; void InitGameplayScreen(void) { - fxbounce = LoadSound("assets/sfx/boing.wav"); - - SetMasterVolume(0.2); + SetMasterVolume(0.5); + fxhit = LoadSound("assets/sfx/hit.wav"); player_sprite = LoadTexture("assets/gfx/player.png"); player.currentframe = 0; player.speed = 300.0f; @@ -56,7 +55,7 @@ void InitGameplayScreen(void) }; enemy.color = RAYWHITE; - + fxfeather = LoadSound("assets/sfx/feather.wav"); feather_sprite = LoadTexture("assets/gfx/feather.png"); heart.hitbox = (Rectangle) { GetRandomValue(0, GetScreenWidth() - feather_sprite.width), @@ -81,7 +80,7 @@ void InitGameplayScreen(void) } pause = 0; - mute = true; + mute = false; DebugMode = 0; pauseTimer = 0; } @@ -143,6 +142,7 @@ void DamagePlayer(void) { if (!player_in) { player.hp--; + if (!mute) PlaySoundMulti(fxhit); player_in = true; } @@ -217,6 +217,7 @@ void UpdateGameplayScreen(void) if (heart.active) { if (CheckCollisionRecs(player.hitbox, heart.hitbox)) { player.hp++; + if (!mute) PlaySoundMulti(fxfeather); heart.hitbox.x = GetRandomValue(0, GetScreenWidth() - feather_sprite.width); heart.hitbox.y = GetRandomValue(0, GetScreenHeight() - feather_sprite.height); heart.active = false; @@ -237,14 +238,20 @@ void UpdateGameplayScreen(void) } for (int i = 0; i < MAX_FIREWORKS; i++) { - if (CheckCollisionRecs(player.hitbox, fireworks[i].hitbox)) DamagePlayer(); + if (CheckCollisionRecs(player.hitbox, fireworks[i].hitbox)) { + DamagePlayer(); + fireworks[i].hp = 0; + } switch (fireworks[i].hp) { case 0: fireworks[i].hitbox.x = enemy.hitbox.x - 20; fireworks[i].hitbox.y = enemy.hitbox.y - 20; - if (GetRandomValue(0, 50) == 50) fireworks[i].hp = 1; + if (GetRandomValue(0, 50) == 50) { + fireworks[i].hp = 1; + fireworks[i].hitbox.y += enemy.hitbox.height/2; + } break; case 1: fireworks[i].hitbox.x += GetFrameTime() * -fireworks[i].speed; @@ -284,12 +291,13 @@ void DrawGameplayScreen(void) DrawTextureRec(player_sprite, player.frameRec, player.sprite_pos, player.color); DrawText(TextFormat("HP: %i", player.hp), 10, 10, 20, RED); DrawText(TextFormat("SCORE: %i", score), 10, 30, 20, BLUE); - if (pause && ((pauseTimer/30)%2)) DrawText("PAUSED", 330, 190, 30, PURPLE); + if (pause && ((pauseTimer/30)%2)) DrawText("PAUSED", 330, 190, 30, WHITE); } void UnloadGameplayScreen() { - UnloadSound(fxbounce); + UnloadSound(fxhit); + UnloadSound(fxfeather); UnloadTexture(player_sprite); UnloadTexture(feather_sprite); UnloadTexture(enemy_sprite); diff --git a/src/Gameplay.h b/src/Gameplay.h index f5f2636..1fbde12 100644 --- a/src/Gameplay.h +++ b/src/Gameplay.h @@ -32,7 +32,8 @@ struct Actor player = { 0 }; struct Actor enemy = { 0 }; struct Actor fireworks[MAX_FIREWORKS] = { 0 }; struct Item heart = { 0 }; -Sound fxbounce = { 0 }; +Sound fxhit = { 0 }; +Sound fxfeather = { 0 }; bool pause; bool mute; bool player_in; diff --git a/src/Title.c b/src/Title.c index c88d112..6a417d1 100644 --- a/src/Title.c +++ b/src/Title.c @@ -17,15 +17,14 @@ int titleSelected = 0; void DrawScore(void) { - if (bestscore >= 10000) { - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, YELLOW); - } else if (bestscore >= 5000) { - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, DARKGRAY); - } else if (bestscore >= 1000) { - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, DARKBROWN); - } else { + if (bestscore >= 10000) + DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 222, 181, 0, 255 }); + else if (bestscore >= 5000) + DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 149, 148, 147, 255 }); + else if (bestscore >= 1000) + DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 138, 72, 4, 255 }); + else DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, BLUE); - } } void InitTitleScreen(void)