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.
Diff: GameEngine/GameEngine.h
- Revision:
- 36:27aa597db3d2
- Parent:
- 34:85ccc16f24d2
- Child:
- 39:fc5586b930e3
diff -r 577c65bf914e -r 27aa597db3d2 GameEngine/GameEngine.h
--- a/GameEngine/GameEngine.h Fri May 15 14:19:54 2020 +0000
+++ b/GameEngine/GameEngine.h Fri May 15 16:31:25 2020 +0000
@@ -41,54 +41,80 @@
/** Gets joystick direction from gamepad and stores it in d_ */
void read_joystick_direction();
- /** Creats weapons object if button A is pressed and stores in vector */
- void create_weapons();
+ //Weapon Control
+ /** Creates weapons object if button A is pressed and stores in vector */
+ void create_weapons_bullets();
+
+ /** Creates smart bomb if button B is pressed */
+ void create_weapons_smart_bomb();
/** Draws each bullet object and deleted object after set movement
* distance
*/
void draw_bullets();
+ //Alien Control
+ /** Spawns aliens in random position of the screen*/
+ void spawn_aliens();
+
/** Creats alien object and stores in vector*/
void create_alien();
+ /** Checks for alien people collision and sets abduction movements
+ * @param i @details iterator from draw_alien for loop
+ */
+ void check_alien_people_collision(int i);
+
+ /** Gets alien to fire bullets randomley towards spaceship
+ * @param i @details iterator from draw_alien for loop
+ */
+ void alliens_fire_bullets(int i);
+
+ /**Deletes bullet and alien if collision detected and draws explosion
+ * @param i @details iterator from draw_alien for loop
+ */
+ void delete_aliens(int i);
+
/** Draws each alien object and deletes both objects if collision
* detected
*/
void draw_aliens();
- /** Creats bullet object if button A is pressed and stores in vector */
+ //Explotion Control
+ /** Creates bullet object if button A is pressed and stores in vector */
void create_explosion(Vector2D destroyed_position);
/** Draws each explosion object if collision detected */
void draw_explosions();
- /** Resets the map after spaceship death*/
- void reset_map();
-
- /** Spawns aliens in random position of the screen*/
- void spawn_aliens();
+ //People Control
+ /** Spawns people in random places at bottom of screen */
+ void spawn_people();
/** Spawns people in random position at bottom of the screen*/
void create_people();
/** Draws each people object */
void draw_people();
+
+ //Map Control
+ /** Resets map after set time so spaceship explosion animation showes */
+ void reset_map_timer();
- /** Spawns people in random places at bottom of screen*/
- void spawn_people();
-
+ /** Resets the map after spaceship death and timer has ended */
+ void reset_map();
+
// Variables ---------------------------------------------------------------
/** Define direction d of joystick*/
Direction d_;
+ /** Flag for if spaceship is destroyed*/
+ bool spaceship_destroyed;
+
/** Number of spaceship lives remaining*/
int spaceship_lives;
- /** Flag for if spaceship is destroyed*/
- bool spaceship_destroyed;
-
/** Counter to reset map after set amount of frames*/
int reset_map_counter;
@@ -96,14 +122,14 @@
int smart_bomb_counter;
/** Counter for spawning aliens*/
- double spawn_alien_rate;
-
- /** Counter for spawning aliens*/
int spawn_alien_counter;
/** Counter for numeber of aliens*/
int alien_number_counter;
+ /** Counter for spawning aliens*/
+ double spawn_alien_rate;
+
// Vectors -----------------------------------------------------------------
/** Vector to store each new bullet object*/