diff --git a/README.md b/README.md index a2ee764..d457d59 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A dumb raylib test which you can play [here](https://canneddonuts.itch.io/avoid- - a tutorial ## Note -This games code more specifically 'Main.c' is a retyped version of this [repo](https://github.com/raysan5/raylib-game-template) which is code under the zlib license. +This game's code more specifically 'Main.c' is a retyped version of this [repo](https://github.com/raysan5/raylib-game-template) which is code under the zlib license. ## Preview ![Alt Text](./doc-assets/preview.png) diff --git a/doc-assets/preview.png b/doc-assets/preview.png index 91ed7e3..06c6afc 100644 Binary files a/doc-assets/preview.png and b/doc-assets/preview.png differ diff --git a/doc-assets/preview1.png b/doc-assets/preview1.png index 09bc60b..44e65eb 100644 Binary files a/doc-assets/preview1.png and b/doc-assets/preview1.png differ diff --git a/doc-assets/preview2.png b/doc-assets/preview2.png index 3ae9798..2a95651 100644 Binary files a/doc-assets/preview2.png and b/doc-assets/preview2.png differ diff --git a/src/Ending.c b/src/Ending.c index a3429e8..2c1b1fd 100644 --- a/src/Ending.c +++ b/src/Ending.c @@ -33,7 +33,7 @@ void UpdateEndingScreen(void) void DrawEndingScreen(void) { DrawTexture(background, 0, 0, GOLD); - DrawTextEx(ZadoBold, "THANK YOU SO MUCH FOR PLAYING!!!", (Vector2){ 10, 10 }, 45, 2, GOLD); + DrawText("THANK YOU SO MUCH FOR PLAYING!!!", 10, 10, 40, GOLD); DrawTextEx(ZadoBold, "Canneddonuts 2022", (Vector2){ 380, 400 }, 40, 2, WHITE); DrawTextEx(ZadoBold, "Press 'ENTER'", (Vector2){ 5, 400 }, 40, 2, WHITE); } diff --git a/src/Gameover.c b/src/Gameover.c index be94a21..672853c 100644 --- a/src/Gameover.c +++ b/src/Gameover.c @@ -43,12 +43,12 @@ void UpdateGameoverScreen(void) void DrawGameoverScreen(void) { DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK); - DrawTextEx(ZadoBold, "GAME OVER", (Vector2){ 190, 0 }, 80, 3, RED); - if (gameoverSelected == 0) DrawTextEx(ZadoBold, "RETRY", (Vector2){ 350, 200 }, 30, 2, WHITE); - else DrawTextEx(ZadoBold, "RETRY", (Vector2){ 350, 200 }, 30, 2, RED); + DrawText("GAME OVER", 170, 10, 80, RED); + if (gameoverSelected == 0) DrawTextEx(ZadoBold, "RETRY", (Vector2){ 340, 200 }, 40, 2, WHITE); + else DrawTextEx(ZadoBold, "RETRY", (Vector2){ 340, 200 }, 40, 2, RED); - if (gameoverSelected == -1) DrawTextEx(ZadoBold, "TITLE", (Vector2){ 355, 240 }, 30, 2, WHITE); - else DrawTextEx(ZadoBold, "TITLE", (Vector2){ 355, 240 }, 30, 2, RED); + if (gameoverSelected == -1) DrawTextEx(ZadoBold, "TITLE", (Vector2){ 345, 250 }, 40, 2, WHITE); + else DrawTextEx(ZadoBold, "TITLE", (Vector2){ 345, 250 }, 40, 2, RED); } int FinishGameoverScreen(void) diff --git a/src/Gameplay.c b/src/Gameplay.c index f56126e..402ea30 100644 --- a/src/Gameplay.c +++ b/src/Gameplay.c @@ -68,7 +68,6 @@ void InitGameplayScreen(void) enemy.currentframe = 0; enemy.hp = 5; - //enemy.speed = 2.0f; enemy.speed = 200.0f; if (GI_callcount < 1) { enemy.frameRec = (Rectangle) { @@ -127,20 +126,10 @@ void InitGameplayScreen(void) pauseTimer = 0; score = 0; scoreTimer = 0; - ewc = 0; GI_callcount++; } -void SetEnemyLevel(void) -{ - switch (level) { - case LEVEL1: enemy.speed = 200.0f; break; - case LEVEL2: enemy.speed = 400.0f; break; - case LEVEL3: enemy.speed = 600.0f; break; - } -} - void DamageActor(struct Actor *actor) { if (!actor->in) { @@ -248,11 +237,12 @@ void UpdateGameplayScreen(void) if (IsKeyPressed(KEY_D)) DebugMode = !DebugMode; if (IsKeyPressed(KEY_NINE)) ammo = 99; if (IsKeyPressed(KEY_ZERO)) ammo = 0; + if (IsKeyPressed(KEY_G)) finishfromGameplayScreen = 1; if (IsKeyPressed(KEY_R)) finishfromGameplayScreen = 2; if (IsKeyPressed(KEY_W)) finishfromGameplayScreen = 3; // call gameover when killed - if (player.hp <= 0) { StopMusicStream(Gameplaysong); finishfromGameplayScreen = 1; } + if (player.hp < 1) { StopMusicStream(Gameplaysong); finishfromGameplayScreen = 1; } // Red feather logic for (int i = 0; i < MAX_SHOOTS; i++) { @@ -285,7 +275,7 @@ void UpdateGameplayScreen(void) case 0: player.hp++; break; case 1: ammo++; break; } - PlaySoundMulti(fxfeather); + if (!mute) PlaySoundMulti(fxfeather); ResetFeather(); } feather.hitbox.x -= 300.0f * GetFrameTime(); @@ -293,16 +283,11 @@ void UpdateGameplayScreen(void) // Enemy logic if (level < 3) { - /* if (((enemy.hitbox.y + enemy.hitbox.height) >= (float)GetScreenHeight() - || (enemy.hitbox.y <= 0))) enemy.speed *= -1.0f; */ - - // if ((int) globalTimer % 50 == 0) - enemy.hitbox.y = GetRandomValue(0, GetScreenHeight() - enemy_sprite.height); - // enemy.hitbox.y += enemy.speed * GetFrameTime(); + if ((int)globalTimer % 40 == 0) enemy.hitbox.y = GetRandomValue(0, GetScreenHeight() - enemy_sprite.height); if (CheckCollisionRecs(player.hitbox, enemy.hitbox)) DamageActor(&player); - if (enemy.hp < 1) { level++; enemy.hp = 5; SetEnemyLevel(); } + if (enemy.hp < 1) { level++; enemy.hp = 5; } } // Firework logic @@ -352,9 +337,6 @@ void DrawGameplayScreen(void) for (int i = 0; i < MAX_SHOOTS; i++) { DrawRectangleLines(shoot[i].hitbox.x, shoot[i].hitbox.y, shoot[i].hitbox.width, shoot[i].hitbox.height, GREEN); } - /*for (int i = 0; i < 2; i++) { - DrawRectangleLines(EnemyBounds[i].x, EnemyBounds[i].y, EnemyBounds[i].width, EnemyBounds[i].height, WHITE); - }*/ DrawText(TextFormat("enemy.hitbox.y: %f", enemy.hitbox.y), 10, 200, 20, GREEN); DrawText(TextFormat("enemy.speed: %f", enemy.speed), 10, 220, 20, GREEN); DrawText(TextFormat("globalTimer: %f", globalTimer), 10, 240, 20, GREEN); @@ -362,7 +344,7 @@ void DrawGameplayScreen(void) DrawText(TextFormat("player.iframetimer: %f", player.iframetimer), 10, 280, 20, GREEN); DrawText(TextFormat("player.in: %d", player.in), 10, 300, 20, GREEN); DrawText(TextFormat("feather.active: %d", feather.active), 10, 320, 20, GREEN); - //DrawText(TextFormat("GetTime(): %f", GetTime()), 10, 320, 20, GREEN); + DrawText(TextFormat("GetTime(): %f", GetTime()), 10, 340, 20, GREEN); } if (feather.active) DrawTexture(feather_sprite, feather.sprite_pos.x, feather.sprite_pos.y, feather.color); DrawTextureRec(enemy_sprite, enemy.frameRec, enemy.sprite_pos, enemy.color); diff --git a/src/Gameplay.h b/src/Gameplay.h index c6e27b0..670750e 100644 --- a/src/Gameplay.h +++ b/src/Gameplay.h @@ -52,7 +52,6 @@ struct Item feather = { 0 }; Sound fxfeather = { 0 }; bool pause; bool DebugMode; -bool ewc; int ammo = 0; int GI_callcount = 0; diff --git a/src/Title.c b/src/Title.c index 326d0be..90153ac 100644 --- a/src/Title.c +++ b/src/Title.c @@ -18,13 +18,13 @@ int titleSelected = 0, finishfromTitleScreen = 0; void DrawScore(void) { if (bestscore >= 10000) - DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 222, 181, 0, 255 }); + DrawText(TextFormat("BEST: %i", bestscore), 580, 0, 30, (Color){ 222, 181, 0, 255 }); else if (bestscore >= 5000) - DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 149, 148, 147, 255 }); + DrawText(TextFormat("BEST: %i", bestscore), 580, 0, 30, (Color){ 149, 148, 147, 255 }); else if (bestscore >= 1000) - DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 138, 72, 4, 255 }); + DrawText(TextFormat("BEST: %i", bestscore), 580, 0, 30,(Color){ 138, 72, 4, 255 }); else - DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, BLUE); + DrawText(TextFormat("BEST: %i", bestscore), 580, 0, 30, BLUE); } @@ -49,15 +49,15 @@ void DrawTitleScreen(void) { DrawTexture(background, 0, 0, GRAY); DrawTextEx(ZadoBold, "Avoid", (Vector2){ 300, 0 }, 80, 5, BLUE); - // DrawText("Controls", 10, 10, 30, BLUE); + DrawText("Controls", 5, 10, 30, BLUE); DrawScore(); - /* DrawText("Press the arrow keys or 'DPAD' to move and 'X' to dash", 10, 40, 10, WHITE); - DrawText("Press 'ENTER' or 'START' to pause", 10, 60, 10, WHITE); - DrawText("Press 'M' to mute", 10, 80, 10, WHITE); - DrawText("Press 'Left-ALT' + 'F' for full screen", 10, 100, 10, WHITE); - DrawText("Press 'R' to restart", 10, 120, 10, WHITE); - DrawText("Press 'ENTER' or 'START' to select an option", 10, 140, 10, WHITE); - DrawText("Press 'X' or 'A' on a gamepad to shoot", 10, 160, 10, WHITE); */ + DrawText("Press the arrow keys or 'DPAD' to move and 'X' to dash", 5, 40, 10, WHITE); + DrawText("Press 'ENTER' or 'START' to pause", 5, 60, 10, WHITE); + DrawText("Press 'M' to mute", 5, 80, 10, WHITE); + DrawText("Press 'Left-ALT' + 'F' for full screen", 5, 100, 10, WHITE); + DrawText("Press 'R' to restart", 5, 120, 10, WHITE); + DrawText("Press 'ENTER' or 'START' to select an option", 5, 140, 10, WHITE); + DrawText("Press 'X' or 'A' on a gamepad to shoot", 5, 160, 10, WHITE); // DrawText("Ver: 0.1", 680, 420, 30, WHITE); if (titleSelected == 0) DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, WHITE); else DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, BLUE);