Nemesis game, engine
Engine Class Reference
#include <Engine.h>
Public Member Functions | |
| Engine () | |
| Constructor and destructor: | |
| void | init (int speed, N5110 &lcd, Gamepad &pad, int _collisions, int _wave_counter, int _ammo, bool _star, int _pauses) |
| Initialize Ships. | |
| void | read_input (Gamepad &pad) |
| Read Input. | |
| void | draw_all (N5110 &lcd) |
| Draw Elements. | |
| void | check_all (N5110 &lcd, Gamepad &pad) |
| Check All. | |
| void | update_all (N5110 &lcd, Gamepad &pad) |
| Update All. | |
| void | shoot_rocket (N5110 &lcd, Gamepad &pad) |
| Shoot Rocket. | |
| void | shoot_star (N5110 &lcd, Gamepad &pad) |
| Shoot Star. | |
Data Fields | |
| int | collisions |
| Integer variable that stores the collisions the friendly ship has with the enemy ships: | |
| int | wave_counter |
| Integer variable that stores the number of the wave the player is currently in (or the number of waves survived): | |
| bool | star |
| Boolean variable that stores if the player has a star available or not: | |
| int | ammo |
| Integer variable that stores the number of rockets the player has available: | |
| int | pauses |
| Integer variable that stores the number of pauses the player has available: | |
| bool | rocket_shot_trigger |
| Boolean variable that stores if a rocket has been shot or not: | |
| bool | health_regen_trigger |
| Boolean variable that stores if health has been regenerated or not: | |
| bool | rocket_regen_trigger |
| Boolean variable that stores if a rocket has been regenerated or not: | |
| bool | star_regen_trigger |
| Boolean variable that stores if a star has been regenerated or not: | |
Detailed Description
Engine Class.
Engine for interfacing with the Nemesis game. Includes drawing, checking, game state-changing methods, for Friendly and Enemy ships, Weapons, and Stats bar. Incorporates N5110.h and Gamepad.h files by Craig A. Evans.
Revision 1.0
- Date:
- 3rd May 2017
Definition at line 28 of file Engine.h.
Constructor & Destructor Documentation
| Engine | ( | ) |
Constructor and destructor:
Definition at line 9 of file Engine.cpp.
Member Function Documentation
| void check_all | ( | N5110 & | lcd, |
| Gamepad & | pad | ||
| ) |
Check All.
Method that includes all other checking methods
- Parameters:
-
N5110 - nokia LCD library lcd - pointer to nokia LCD library Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 82 of file Engine.cpp.
| void draw_all | ( | N5110 & | lcd ) |
Draw Elements.
Draws grid, health, weapons, wave counter, and friendly and enemy ships onto the LCD
- Parameters:
-
N5110 - nokia LCD library lcd - pointer to nokia LCD library
Definition at line 59 of file Engine.cpp.
| void init | ( | int | speed, |
| N5110 & | lcd, | ||
| Gamepad & | pad, | ||
| int | _collisions, | ||
| int | _wave_counter, | ||
| int | _ammo, | ||
| bool | _star, | ||
| int | _pauses | ||
| ) |
Initialize Ships.
Initializes friendly and enemy ships' velocity (enemies) and x & y positions (both).
- Parameters:
-
speed - velocity of ship N5110 - nokia LCD library lcd - pointer to nokia LCD library Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 25 of file Engine.cpp.
| void read_input | ( | Gamepad & | pad ) |
Read Input.
Reads direction (_d) and magnitude (_mag) from gamepad analog stick.
- Parameters:
-
Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 50 of file Engine.cpp.
| void shoot_rocket | ( | N5110 & | lcd, |
| Gamepad & | pad | ||
| ) |
Shoot Rocket.
Triggers a rocket to be shot from the friendly ship, destroying enemy ship opposite, at the press of a button (B). Checks if rockets ("ammo" variable) available, draws rocket onto screen, triggers "check_enemy_death" method, subtracts 1 from "ammo", and outputs a sound. First of two weapon types.
- Parameters:
-
N5110 - nokia LCD library lcd - pointer to nokia LCD library Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 119 of file Engine.cpp.
| void shoot_star | ( | N5110 & | lcd, |
| Gamepad & | pad | ||
| ) |
Shoot Star.
Triggers a star to be shot from the friendly ship, destroying all enemy ships, at the press of a button (A). Checks if star ("star" variable) available, sets "star" to false, and outputs a sound. Second of two weapon types.
- Parameters:
-
N5110 - nokia LCD library lcd - pointer to nokia LCD library Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 141 of file Engine.cpp.
| void update_all | ( | N5110 & | lcd, |
| Gamepad & | pad | ||
| ) |
Update All.
Updates friendly and enemy ship parameters (position), as well as making sure the friendly ship doesn't go off screen by limiting its x and y positions.
- Parameters:
-
N5110 - nokia LCD library lcd - pointer to nokia LCD library Gamepad - gamepad library pad - pointer to gamepad library
Definition at line 101 of file Engine.cpp.
Field Documentation
| int ammo |
| int collisions |
| bool health_regen_trigger |
| int pauses |
| bool rocket_regen_trigger |
| bool rocket_shot_trigger |
| bool star |
| bool star_regen_trigger |
| int wave_counter |
Generated on Wed Jul 13 2022 19:16:01 by
1.7.2