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
TanksEngine/TanksEngine.h@15:fa5282fcd134, 2019-04-19 (annotated)
- Committer:
- el17mcd
- Date:
- Fri Apr 19 15:58:51 2019 +0000
- Revision:
- 15:fa5282fcd134
- Parent:
- 14:fe2e16cdf219
- Child:
- 16:a2c945279b79
! New Menus class that holds the menus for the game. Settings menu to toggle sound, change contrast and number of lives players start with.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17mcd | 7:a3ccabdebe2e | 1 | //#ifndef TANKENGINE_H |
el17mcd | 7:a3ccabdebe2e | 2 | //#define TANKENGINE_H |
el17mcd | 7:a3ccabdebe2e | 3 | |
el17mcd | 7:a3ccabdebe2e | 4 | #include "mbed.h" |
el17mcd | 7:a3ccabdebe2e | 5 | #include "N5110.h" |
el17mcd | 7:a3ccabdebe2e | 6 | #include "Gamepad.h" |
el17mcd | 7:a3ccabdebe2e | 7 | #include "Projectile.h" |
el17mcd | 12:9e6d5d0a0c82 | 8 | #include "Tank.h" |
el17mcd | 12:9e6d5d0a0c82 | 9 | #include "Graphics.h" |
el17mcd | 15:fa5282fcd134 | 10 | #include "Menus.h" |
el17mcd | 7:a3ccabdebe2e | 11 | |
el17mcd | 7:a3ccabdebe2e | 12 | class TanksEngine |
el17mcd | 7:a3ccabdebe2e | 13 | { |
el17mcd | 7:a3ccabdebe2e | 14 | public: |
el17mcd | 11:4e2eb64031a0 | 15 | |
el17mcd | 11:4e2eb64031a0 | 16 | TanksEngine(); |
el17mcd | 15:fa5282fcd134 | 17 | ~TanksEngine(); |
el17mcd | 15:fa5282fcd134 | 18 | void initgame(Menus &menus); |
el17mcd | 15:fa5282fcd134 | 19 | void game_loop(Graphics &graphics, N5110 &lcd, Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 20 | |
el17mcd | 11:4e2eb64031a0 | 21 | int get_turn(); |
el17mcd | 7:a3ccabdebe2e | 22 | |
el17mcd | 7:a3ccabdebe2e | 23 | private: |
el17mcd | 12:9e6d5d0a0c82 | 24 | |
el17mcd | 15:fa5282fcd134 | 25 | void _left_tank_turn(Graphics &graphics, Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 26 | void _right_tank_turn(Graphics &graphics, Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 27 | void _projectile_phase(N5110 &lcd, Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 28 | void _end(Graphics &graphics, N5110 &lcd, Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 29 | void _read_input(Gamepad &pad); |
el17mcd | 15:fa5282fcd134 | 30 | void _render(Graphics graphics, N5110 &lcd); |
el17mcd | 15:fa5282fcd134 | 31 | void _tank_shoots(int x, int y, int turn, Gamepad &pad); |
el17mcd | 12:9e6d5d0a0c82 | 32 | bool _collision_pl(Tank _tankl, Projectile _proj); |
el17mcd | 13:feadff02d3f7 | 33 | bool _collision_pr(Tank _tankr, Projectile _proj); |
el17mcd | 13:feadff02d3f7 | 34 | bool _collision_pm(N5110 &lcd, Projectile _proj); |
el17mcd | 15:fa5282fcd134 | 35 | void _object_hit(N5110 &lcd, Gamepad &pad); |
el17mcd | 11:4e2eb64031a0 | 36 | void _change_turn(); |
el17mcd | 15:fa5282fcd134 | 37 | void _sounds(int n, Gamepad &pad); |
el17mcd | 12:9e6d5d0a0c82 | 38 | void _decrement_cooldowns(); |
el17mcd | 7:a3ccabdebe2e | 39 | |
el17mcd | 15:fa5282fcd134 | 40 | int _cooldown_l; |
el17mcd | 15:fa5282fcd134 | 41 | int _cooldown_r; |
el17mcd | 11:4e2eb64031a0 | 42 | int _turn; |
el17mcd | 11:4e2eb64031a0 | 43 | int _move; |
el17mcd | 15:fa5282fcd134 | 44 | int _score; |
el17mcd | 15:fa5282fcd134 | 45 | int _initial_health; |
el17mcd | 11:4e2eb64031a0 | 46 | bool _fire; |
el17mcd | 15:fa5282fcd134 | 47 | bool _mute; |
el17mcd | 11:4e2eb64031a0 | 48 | float _angle; |
el17mcd | 14:fe2e16cdf219 | 49 | float _mag; |
el17mcd | 13:feadff02d3f7 | 50 | float _vel; |
el17mcd | 13:feadff02d3f7 | 51 | float _grav; |
el17mcd | 13:feadff02d3f7 | 52 | float _wind; |
el17mcd | 11:4e2eb64031a0 | 53 | |
el17mcd | 12:9e6d5d0a0c82 | 54 | Tank _tankl; |
el17mcd | 12:9e6d5d0a0c82 | 55 | Tank _tankr; |
el17mcd | 11:4e2eb64031a0 | 56 | |
el17mcd | 11:4e2eb64031a0 | 57 | Projectile _proj; |
el17mcd | 13:feadff02d3f7 | 58 | |
el17mcd | 7:a3ccabdebe2e | 59 | }; |
el17mcd | 7:a3ccabdebe2e | 60 |