Initial publish

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

Committer:
Noximilien
Date:
Wed Apr 10 15:42:10 2019 +0000
Revision:
28:35af3843de8f
Parent:
27:f05f4e738ba9
Child:
29:579e00b7f118
Moved starSpawnDelay to stars.h. Made enemies move y-direction as the game score increase. Added more comments. Cleaned the code a bit. Changed struct to gameObject in the main.cpp. Made some functions less than 20 lines.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Noximilien 3:10918b0f7a7d 1 #ifndef GAME_H
Noximilien 3:10918b0f7a7d 2 #define GAME_H
Noximilien 3:10918b0f7a7d 3
Noximilien 21:0eb394495b8a 4 #include "geometry.h"
Noximilien 27:f05f4e738ba9 5
Noximilien 25:749f1efc31fc 6 extern int game_score;
Noximilien 26:676874c42883 7 extern int score_count_for_difficulty;
Noximilien 25:749f1efc31fc 8 extern int player_lifes;
Noximilien 25:749f1efc31fc 9 extern bool red_led_state;
Noximilien 25:749f1efc31fc 10 extern int red_led_flashing;
Noximilien 28:35af3843de8f 11 extern int high_score;
Noximilien 24:0570cb4b92d7 12
Noximilien 4:02c63aaa2df9 13 class Game{
Noximilien 4:02c63aaa2df9 14 public:
Noximilien 27:f05f4e738ba9 15 /** This is the main function of game.cpp, where the actual gameplay happens.
Noximilien 27:f05f4e738ba9 16 * Here all other functions are activeated, and when the player dies, it
Noximilien 27:f05f4e738ba9 17 * returns back to main menu "main.cpp".
Noximilien 27:f05f4e738ba9 18 */
Noximilien 27:f05f4e738ba9 19 bool updateAndDraw();
Noximilien 27:f05f4e738ba9 20 /** This function resets all the values to their intial states when the game is
Noximilien 27:f05f4e738ba9 21 * first began when the player dies and wants to restart the game.
Noximilien 27:f05f4e738ba9 22 * It does not reset the values when the game is paused.
Noximilien 27:f05f4e738ba9 23 */
Noximilien 21:0eb394495b8a 24 void startNewGame();
Noximilien 4:02c63aaa2df9 25 private:
Noximilien 27:f05f4e738ba9 26 bool checkForGameOver();
Noximilien 21:0eb394495b8a 27 void collideEnemiesAndBlasts();
Noximilien 21:0eb394495b8a 28 void collideEnemiesBlastsAndPlayer();
Noximilien 23:240bc00ef25b 29 void collideEnemiesAndPlayer();
Noximilien 26:676874c42883 30 void starsSpawnDelay();
Noximilien 26:676874c42883 31 void increaseGameDifficultyAndEnemySpawnDelay();
Noximilien 23:240bc00ef25b 32 void gameOver();
Noximilien 28:35af3843de8f 33 void drawGameOver();
Noximilien 3:10918b0f7a7d 34 };
Noximilien 3:10918b0f7a7d 35
Noximilien 3:10918b0f7a7d 36
Noximilien 3:10918b0f7a7d 37 #endif