Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17dg by
game/game.h@27:f05f4e738ba9, 2019-04-08 (annotated)
- Committer:
- Noximilien
- Date:
- Mon Apr 08 14:41:57 2019 +0000
- Revision:
- 27:f05f4e738ba9
- Parent:
- 26:676874c42883
- Child:
- 28:35af3843de8f
I have created "press START" for the intro pause. Added more comments for the report. Fixed the bug I had in my small star function. Changed some drawsprite functions to new one I made. Slightly simplified the code.
Who changed what in which revision?
User | Revision | Line number | New 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 | 24:0570cb4b92d7 | 11 | |
Noximilien | 4:02c63aaa2df9 | 12 | class Game{ |
Noximilien | 4:02c63aaa2df9 | 13 | public: |
Noximilien | 27:f05f4e738ba9 | 14 | /** This is the main function of game.cpp, where the actual gameplay happens. |
Noximilien | 27:f05f4e738ba9 | 15 | * Here all other functions are activeated, and when the player dies, it |
Noximilien | 27:f05f4e738ba9 | 16 | * returns back to main menu "main.cpp". |
Noximilien | 27:f05f4e738ba9 | 17 | */ |
Noximilien | 27:f05f4e738ba9 | 18 | bool updateAndDraw(); |
Noximilien | 27:f05f4e738ba9 | 19 | /** This function resets all the values to their intial states when the game is |
Noximilien | 27:f05f4e738ba9 | 20 | * first began when the player dies and wants to restart the game. |
Noximilien | 27:f05f4e738ba9 | 21 | * It does not reset the values when the game is paused. |
Noximilien | 27:f05f4e738ba9 | 22 | */ |
Noximilien | 21:0eb394495b8a | 23 | void startNewGame(); |
Noximilien | 4:02c63aaa2df9 | 24 | private: |
Noximilien | 27:f05f4e738ba9 | 25 | bool checkForGameOver(); |
Noximilien | 21:0eb394495b8a | 26 | void collideEnemiesAndBlasts(); |
Noximilien | 21:0eb394495b8a | 27 | void collideEnemiesBlastsAndPlayer(); |
Noximilien | 23:240bc00ef25b | 28 | void collideEnemiesAndPlayer(); |
Noximilien | 26:676874c42883 | 29 | void starsSpawnDelay(); |
Noximilien | 26:676874c42883 | 30 | void increaseGameDifficultyAndEnemySpawnDelay(); |
Noximilien | 23:240bc00ef25b | 31 | void gameOver(); |
Noximilien | 3:10918b0f7a7d | 32 | }; |
Noximilien | 3:10918b0f7a7d | 33 | |
Noximilien | 3:10918b0f7a7d | 34 | |
Noximilien | 3:10918b0f7a7d | 35 | #endif |