cleaned unnecessary gameReset calls & cleaned up some text
This commit is contained in:
parent
920c7c5a07
commit
f178ca3ae1
29
src/Main.c
29
src/Main.c
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
- Avoid a game by Canneddonuts
|
||||||
|
- Filename ~ Main.c
|
||||||
|
- Author ~ Return0ne
|
||||||
|
- 2022
|
||||||
|
- *no license*
|
||||||
|
*/
|
||||||
#include "../include/raylib.h"
|
#include "../include/raylib.h"
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
|
@ -167,7 +174,7 @@ void updateGame(void)
|
||||||
|
|
||||||
if (ball.active) {
|
if (ball.active) {
|
||||||
score++;
|
score++;
|
||||||
// moveiement oof the balls
|
// moveiement of the balls
|
||||||
ball.position.x += GetFrameTime() * ball.speed.x;
|
ball.position.x += GetFrameTime() * ball.speed.x;
|
||||||
ball.position.y += GetFrameTime() * ball.speed.y;
|
ball.position.y += GetFrameTime() * ball.speed.y;
|
||||||
|
|
||||||
|
@ -201,12 +208,11 @@ void updateGame(void)
|
||||||
if (gameoverSelected > 0) gameoverSelected--;
|
if (gameoverSelected > 0) gameoverSelected--;
|
||||||
if (gameoverSelected < -1) gameoverSelected++;
|
if (gameoverSelected < -1) gameoverSelected++;
|
||||||
|
|
||||||
if ((gameoverSelected == 0) && (IsKeyPressed(KEY_ENTER))) {
|
if ((gameoverSelected == 0) && (IsKeyPressed(KEY_ENTER)))
|
||||||
gameReset();
|
|
||||||
currentScreen = GAMEPLAY;
|
currentScreen = GAMEPLAY;
|
||||||
}
|
|
||||||
|
|
||||||
if ((gameoverSelected == -1) && (IsKeyPressed(KEY_ENTER))) gameReset();
|
if ((gameoverSelected == -1) && (IsKeyPressed(KEY_ENTER)))
|
||||||
|
currentScreen = TITLE;
|
||||||
break;
|
break;
|
||||||
case CREDITS:
|
case CREDITS:
|
||||||
if (IsKeyPressed(KEY_ENTER)) currentScreen = TITLE;
|
if (IsKeyPressed(KEY_ENTER)) currentScreen = TITLE;
|
||||||
|
@ -261,17 +267,16 @@ void drawGame(void)
|
||||||
if (gameoverSelected == 0) DrawText("RETRY", 350, 200, 20, WHITE);
|
if (gameoverSelected == 0) DrawText("RETRY", 350, 200, 20, WHITE);
|
||||||
else DrawText("RETRY", 350, 200, 20, RED);
|
else DrawText("RETRY", 350, 200, 20, RED);
|
||||||
|
|
||||||
if (gameoverSelected == -1) DrawText("TITLE", 350, 230, 20, WHITE);
|
if (gameoverSelected == -1) DrawText("TITLE", 352, 230, 20, WHITE);
|
||||||
else DrawText("TITLE", 350, 230, 20, RED);
|
else DrawText("TITLE", 352, 230, 20, RED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CREDITS:
|
case CREDITS:
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
|
DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
|
||||||
DrawText("Avoid", 330, 20, 50, MAGENTA);
|
DrawText("Avoid", 330, 20, 50, MAGENTA);
|
||||||
DrawText("Programming by Return0ne", 10, 210, 20, BLUE);
|
DrawText("Programming and Art by Return0ne", 10, 210, 20, BLUE);
|
||||||
DrawText("Morale support by Tobi/Tobrella and Jelly_man", 10, 240, 20, BLUE);
|
DrawText("Powered by raylib 4.0", 10, 240, 20, BLUE);
|
||||||
DrawText("Powered by raylib 4.0", 10, 270, 20, BLUE);
|
DrawText("A Canneddonuts project 2022", 10, 270, 40, RED);
|
||||||
DrawText("A Canneddonuts project 2022", 10, 310, 40, RED);
|
|
||||||
DrawText("Press 'ENTER' ", 10, 350, 20, WHITE);
|
DrawText("Press 'ENTER' ", 10, 350, 20, WHITE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -284,8 +289,6 @@ void drawGame(void)
|
||||||
void gameReset(void)
|
void gameReset(void)
|
||||||
{
|
{
|
||||||
// code to reset all variables without reloading assets
|
// code to reset all variables without reloading assets
|
||||||
currentScreen = TITLE;
|
|
||||||
|
|
||||||
player.currentframe = 0;
|
player.currentframe = 0;
|
||||||
player.hp = 30;
|
player.hp = 30;
|
||||||
player.hitbox = (Rectangle) {
|
player.hitbox = (Rectangle) {
|
||||||
|
|
Loading…
Reference in New Issue