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
Diff: TanksEngine/TanksEngine.h
- Revision:
- 16:a2c945279b79
- Parent:
- 15:fa5282fcd134
- Child:
- 17:cb39d9fa08dc
--- a/TanksEngine/TanksEngine.h Fri Apr 19 15:58:51 2019 +0000 +++ b/TanksEngine/TanksEngine.h Wed Apr 24 13:44:12 2019 +0000 @@ -1,5 +1,5 @@ -//#ifndef TANKENGINE_H -//#define TANKENGINE_H +#ifndef TANKENGINE_H +#define TANKENGINE_H #include "mbed.h" #include "N5110.h" @@ -8,41 +8,51 @@ #include "Tank.h" #include "Graphics.h" #include "Menus.h" +#include "Scores.h" class TanksEngine { + public: TanksEngine(); - ~TanksEngine(); + ~TanksEngine(); + void initgame(Menus &menus); - void game_loop(Graphics &graphics, N5110 &lcd, Gamepad &pad); - - int get_turn(); + void game_loop(Graphics &graphics, N5110 &lcd, Gamepad &pad, Menus &menus, Scores &scores); private: + // Game Flow void _left_tank_turn(Graphics &graphics, Gamepad &pad); void _right_tank_turn(Graphics &graphics, Gamepad &pad); void _projectile_phase(N5110 &lcd, Gamepad &pad); - void _end(Graphics &graphics, N5110 &lcd, Gamepad &pad); - void _read_input(Gamepad &pad); - void _render(Graphics graphics, N5110 &lcd); + void _change_turn(); + void _end(Graphics &graphics, N5110 &lcd, Gamepad &pad, Scores &scores); + // Game Mechanics void _tank_shoots(int x, int y, int turn, Gamepad &pad); + void _object_hit(int x, int y, N5110 &lcd, Gamepad &pad); bool _collision_pl(Tank _tankl, Projectile _proj); bool _collision_pr(Tank _tankr, Projectile _proj); - bool _collision_pm(N5110 &lcd, Projectile _proj); - void _object_hit(N5110 &lcd, Gamepad &pad); - void _change_turn(); + bool _collision_pm(int x, int y, N5110 &lcd, Projectile _proj); + // Game Inputs + void _read_input(Gamepad &pad); + void _decrement_cooldowns(); + // Game Outputs + void _draw(Graphics graphics, N5110 &lcd); void _sounds(int n, Gamepad &pad); - void _decrement_cooldowns(); + + Tank _tankl; + Tank _tankr; + Projectile _proj; + + int _initial_health; int _cooldown_l; int _cooldown_r; + int _move; int _turn; - int _move; - int _score; - int _initial_health; + int _turn_counter; bool _fire; bool _mute; float _angle; @@ -50,11 +60,7 @@ float _vel; float _grav; float _wind; - - Tank _tankl; - Tank _tankr; - - Projectile _proj; }; +#endif // TANKSENGINE_H \ No newline at end of file