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 N5110 ShiftReg PinDetect
Diff: Game.h
- Revision:
- 18:709ea375b0df
- Parent:
- 17:d6a3b29cab31
- Child:
- 19:89c3eeb3761b
diff -r d6a3b29cab31 -r 709ea375b0df Game.h
--- a/Game.h Mon May 11 03:52:18 2015 +0000
+++ b/Game.h Mon May 11 04:40:23 2015 +0000
@@ -6,7 +6,6 @@
*/
#include "State.h"
-#include "Resources.h"
#include "Entity.h"
#include "Enemy.h"
#include "map.h"
@@ -37,27 +36,27 @@
private:
- void init(); /// Sets some initial values
- void spawnEnemy(); /// Spawns a new enemy
- void moveEnemies(); /// Movement and AI for all enemies
- void moveWithCollisionTest(Entity* entity, const int map[HEIGHT][WIDTH]); /// Moves entity in map. If collision occurs, entity can not move further.
- bool hitTestRect(Rectangle r1, Rectangle r2); /// Returns true if two rectangles overlap
- bool bulletHitMap(Rectangle &bulletColRect, const int map[HEIGHT][WIDTH]); /// Help function for detecting collision between moving bullet and map.
- void renderScore(); /// Draws the current score in upper right corner
- void respawnPlayer(); /// Respawns player at start position
+ void init(); // Sets some initial values
+ void spawnEnemy(); // Spawns a new enemy
+ void moveEnemies(); // Movement and AI for all enemies
+ void moveWithCollisionTest(Entity* entity, const int map[HEIGHT][WIDTH]); // Moves entity in map. If collision occurs, entity can not move further.
+ bool hitTestRect(Rectangle r1, Rectangle r2); // Returns true if two rectangles overlap @see https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection#Axis-Aligned_Bounding_Box
+ bool bulletHitMap(Rectangle &bulletColRect, const int map[HEIGHT][WIDTH]); // Help function for detecting collision between moving bullet and map.
+ void renderScore(); // Draws the current score in upper right corner
+ void respawnPlayer(); // Respawns player at start position
- int livesLeft; /// The number of lives left
- bool paused; // True if the game is paused
+ int livesLeft; // The number of lives left
+ bool paused; // True if the game is paused
- int spawnRate; /// Probability of enemy spawning in a single frame/update.
- static const int spawnPoints[3][2]; /// Positions where enemies can spawn.
+ int spawnRate; // Probability of enemy spawning in a single frame/update.
+ static const int spawnPoints[3][2]; // Positions where enemies can spawn.
- Entity player; /// Player object
- std::vector<Point*> bullets; /// Container for bullets
- std::vector<Enemy*> enemies; /// Container for enemies
+ Entity player; // Player object
+ std::vector<Point*> bullets; // Container for bullets
+ std::vector<Enemy*> enemies; // Container for enemies
- bool releasedBtnB; /// True if button B has been released after being pressed down
- bool releasedBtnC; /// True if button C has been released after being pressed down
+ bool releasedBtnB; // True if button B has been released after being pressed down
+ bool releasedBtnC; // True if button C has been released after being pressed down
};
#endif