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@14:fe2e16cdf219, 2019-04-17 (annotated)
- Committer:
- el17mcd
- Date:
- Wed Apr 17 17:24:02 2019 +0000
- Revision:
- 14:fe2e16cdf219
- Parent:
- 13:feadff02d3f7
- Child:
- 15:fa5282fcd134
! Game now includes randomised wind that changes every turn. A bar at the top of the screen shows the severity of the wind in the x direction. Dot reticle added to show where the projectile is aimed.
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 | 13:feadff02d3f7 | 10 | #include "Maps.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 | 11:4e2eb64031a0 | 17 | ~TanksEngine(); |
el17mcd | 7:a3ccabdebe2e | 18 | |
el17mcd | 11:4e2eb64031a0 | 19 | void initgame(); |
el17mcd | 13:feadff02d3f7 | 20 | void left_tank_turn(Graphics &graphics, Gamepad &pad); |
el17mcd | 13:feadff02d3f7 | 21 | void right_tank_turn(Graphics &graphics, Gamepad &pad); |
el17mcd | 13:feadff02d3f7 | 22 | void projectile_phase(N5110 &lcd); |
el17mcd | 12:9e6d5d0a0c82 | 23 | void read_input(Gamepad &pad); |
el17mcd | 12:9e6d5d0a0c82 | 24 | void render(Graphics graphics, N5110 &lcd); |
el17mcd | 11:4e2eb64031a0 | 25 | int get_turn(); |
el17mcd | 12:9e6d5d0a0c82 | 26 | void end(); |
el17mcd | 7:a3ccabdebe2e | 27 | |
el17mcd | 7:a3ccabdebe2e | 28 | private: |
el17mcd | 12:9e6d5d0a0c82 | 29 | |
el17mcd | 11:4e2eb64031a0 | 30 | void _left_tank_shoots(); |
el17mcd | 12:9e6d5d0a0c82 | 31 | void _right_tank_shoots(); |
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 | 13:feadff02d3f7 | 35 | void _object_hit(N5110 &lcd); |
el17mcd | 11:4e2eb64031a0 | 36 | void _change_turn(); |
el17mcd | 12:9e6d5d0a0c82 | 37 | void _decrement_cooldowns(); |
el17mcd | 7:a3ccabdebe2e | 38 | |
el17mcd | 12:9e6d5d0a0c82 | 39 | int cooldownl; |
el17mcd | 12:9e6d5d0a0c82 | 40 | int cooldownr; |
el17mcd | 11:4e2eb64031a0 | 41 | int _turn; |
el17mcd | 11:4e2eb64031a0 | 42 | int _turn_timer; |
el17mcd | 11:4e2eb64031a0 | 43 | int _move; |
el17mcd | 11:4e2eb64031a0 | 44 | bool _fire; |
el17mcd | 11:4e2eb64031a0 | 45 | float _angle; |
el17mcd | 14:fe2e16cdf219 | 46 | float _mag; |
el17mcd | 13:feadff02d3f7 | 47 | float _vel; |
el17mcd | 13:feadff02d3f7 | 48 | float _grav; |
el17mcd | 13:feadff02d3f7 | 49 | float _wind; |
el17mcd | 11:4e2eb64031a0 | 50 | |
el17mcd | 12:9e6d5d0a0c82 | 51 | Tank _tankl; |
el17mcd | 12:9e6d5d0a0c82 | 52 | Tank _tankr; |
el17mcd | 11:4e2eb64031a0 | 53 | |
el17mcd | 11:4e2eb64031a0 | 54 | Projectile _proj; |
el17mcd | 13:feadff02d3f7 | 55 | |
el17mcd | 7:a3ccabdebe2e | 56 | }; |
el17mcd | 7:a3ccabdebe2e | 57 |