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.
GameEngine Class Reference
GameEngine class. More...
#include <GameEngine.h>
Inherits PlayEngine.
Public Member Functions | |
| GameEngine () | |
| Constructor. | |
| ~GameEngine () | |
| Destructor. | |
| void | init () |
| Initialises GameEngine. | |
| void | game_select_part () |
| Switch statement to run different menu options. | |
Private Member Functions | |
| void | read_joystick_direction () |
| Gets joystick direction from gamepad and stores it in d_. | |
| void | read_accelerometer_direction (float roll, float pitch) |
| Gets the pitch and roll of the gamepad and calculates d_. | |
| void | spaceship_lives_leds () |
| Turns on specific leds depending on how many lives left. | |
| void | create_weapons_bullets () |
| Creates weapons object if button A is pressed and stores in vector. | |
| void | create_weapons_smart_bomb () |
| Creates smart bomb if button B is pressed. | |
| void | draw_bullets () |
| Draws each bullet object and deleted object after set movement distance. | |
| void | spawn_aliens () |
| Spawns aliens in random position of the screen. | |
| void | create_alien () |
| Creates alien object and stores in vector. | |
| void | check_alien_people_collision (int i) |
| Checks for alien people collision and sets abduction movements. | |
| void | alliens_fire_bullets (int i) |
| Gets alien to fire bullets randomly towards spaceship. | |
| void | delete_aliens (int i) |
| Deletes bullet and alien if collision detected and draws explosion. | |
| void | draw_aliens () |
| Draws each alien object and deletes both objects if collision detected. | |
| void | create_explosion (Vector2D destroyed_position) |
| Creates bullet object if button A is pressed and stores in vector. | |
| void | draw_explosions () |
| Draws each explosion object if collision detected. | |
| void | spawn_people () |
| Spawns people in random places at bottom of screen. | |
| void | create_people () |
| Spawns people in random position at bottom of the screen. | |
| void | draw_people () |
| Draws each people object. | |
| void | reset_map_timer () |
| Resets map after set time so spaceship explosion animation shows. | |
| void | reset_map () |
| Resets the map after spaceship death and timer has ended. | |
Private Attributes | |
| int | points_ |
| Define points. | |
| Direction | d_ |
| Define direction d of joystick. | |
| bool | spaceship_destroyed_ |
| Flag for if spaceship is destroyed. | |
| int | spaceship_lives_ |
| Number of spaceship lives remaining. | |
| int | smart_bomb_timer_ |
| Counter for smart bomb timer. | |
| int | bullet_timer_ |
| Counter for bullet timer. | |
| int | smart_bomb_counter_ |
| Counter for how smart bombs left. | |
| int | spawn_alien_counter_ |
| Counter for spawning aliens. | |
| int | alien_number_ |
| Number of aliens on the screen at a time. | |
| int | spawn_time_multipler_ |
| Multiplier to increase number of alien as time goes on. | |
| int | reset_map_counter_ |
| Counter to reset map after set amount of frames. | |
| SoundParts | sound_fx_ |
| Hold on or off depending if sound fx are set on or off. | |
| std::vector< Weapons > | bullet_vector |
| Vector to store each new bullet object. | |
| std::vector< Weapons > | alien_bullet_vector |
| Vector to store each alien bullet object. | |
| std::vector< Alien > | alien_vector |
| Vector to store each new alien object. | |
| std::vector< Explosion > | explosion_vector |
| Vector to store each new explosion object. | |
| std::vector< People > | people_vector |
| Vector to store each new people object. | |
| Gamepad | pad |
| Define Gamepad object. | |
| N5110 | lcd |
| Define LCD object. | |
| Spaceship | spaceship |
| Define Spaceship object. | |
| Map | map |
| Define Map object. | |
| Weapons | weapons |
| Define Weapons object. | |
Detailed Description
GameEngine class.
Runs the different parts of the menu and playable part of game
- Date:
- April 2020
Definition at line 20 of file GameEngine.h.
Constructor & Destructor Documentation
| GameEngine | ( | ) |
Constructor.
Definition at line 9 of file GameEngine.cpp.
| ~GameEngine | ( | ) |
Destructor.
Definition at line 14 of file GameEngine.cpp.
Member Function Documentation
| void game_select_part | ( | ) |
Switch statement to run different menu options.
Definition at line 58 of file GameEngine.cpp.
| void init | ( | ) |
Initialises GameEngine.
Definition at line 18 of file GameEngine.cpp.
Generated on Fri Aug 5 2022 06:55:08 by
1.7.2