summaryrefslogtreecommitdiffhomepage
path: root/games/asteroids.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-21 17:47:06 +0200
committerRay <[email protected]>2019-05-21 17:47:06 +0200
commit8b4f58b9e9d3deef9e1f1dfebece16a9aca1e62f (patch)
tree049e864ba695cc1a76fb29bf1c2785ce762e00a9 /games/asteroids.c
parent0027868d1f4ba76043e1cdfbb5c172696ad0985b (diff)
downloadraylib-8b4f58b9e9d3deef9e1f1dfebece16a9aca1e62f.tar.gz
raylib-8b4f58b9e9d3deef9e1f1dfebece16a9aca1e62f.zip
Review sample games
Diffstat (limited to 'games/asteroids.c')
-rw-r--r--games/asteroids.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/games/asteroids.c b/games/asteroids.c
index 80096de6..93d5065b 100644
--- a/games/asteroids.c
+++ b/games/asteroids.c
@@ -34,7 +34,6 @@
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
-
typedef struct Player {
Vector2 position;
Vector2 speed;
@@ -65,25 +64,25 @@ typedef struct Meteor {
//------------------------------------------------------------------------------------
// Global Variables Declaration
//------------------------------------------------------------------------------------
-static int screenWidth = 800;
-static int screenHeight = 450;
+static const int screenWidth = 800;
+static const int screenHeight = 450;
-static bool gameOver;
-static bool pause;
-static bool victory;
+static bool gameOver = false;
+static bool pause = false;
+static bool victory = false;
// NOTE: Defined triangle is isosceles with common angles of 70 degrees.
-static float shipHeight;
+static float shipHeight = 0.0f;
-static Player player;
-static Shoot shoot[PLAYER_MAX_SHOOTS];
-static Meteor bigMeteor[MAX_BIG_METEORS];
-static Meteor mediumMeteor[MAX_MEDIUM_METEORS];
-static Meteor smallMeteor[MAX_SMALL_METEORS];
+static Player player = { 0 };
+static Shoot shoot[PLAYER_MAX_SHOOTS] = { 0 };
+static Meteor bigMeteor[MAX_BIG_METEORS] = { 0 };
+static Meteor mediumMeteor[MAX_MEDIUM_METEORS] = { 0 };
+static Meteor smallMeteor[MAX_SMALL_METEORS] = { 0 };
-static int midMeteorsCount;
-static int smallMeteorsCount;
-static int destroyedMeteorsCount;
+static int midMeteorsCount = 0;
+static int smallMeteorsCount = 0;
+static int destroyedMeteorsCount = 0;
//------------------------------------------------------------------------------------
// Module Functions Declaration (local)
@@ -108,7 +107,6 @@ int main(void)
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
-
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@@ -121,7 +119,6 @@ int main(void)
//----------------------------------------------------------------------------------
}
#endif
-
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadGame(); // Unload loaded data (textures, sounds, models...)