ELEC2645 (2018/19) / Mbed 2 deprecated EL17MCD

Dependencies:   mbed

Committer:
el17mcd
Date:
Wed Apr 17 14:03:14 2019 +0000
Revision:
13:feadff02d3f7
Parent:
12:9e6d5d0a0c82
Child:
14:fe2e16cdf219
! Tank's Health displayed on gamepad LEDs. Change the 'power' of the tanks shots (potentiometer controls velocity). Tanks cannot move outside of screen or across map object.

Who changed what in which revision?

UserRevisionLine numberNew 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 13:feadff02d3f7 46 float _vel;
el17mcd 13:feadff02d3f7 47 float _grav;
el17mcd 13:feadff02d3f7 48 float _wind;
el17mcd 11:4e2eb64031a0 49
el17mcd 12:9e6d5d0a0c82 50 Tank _tankl;
el17mcd 12:9e6d5d0a0c82 51 Tank _tankr;
el17mcd 11:4e2eb64031a0 52
el17mcd 11:4e2eb64031a0 53 Projectile _proj;
el17mcd 13:feadff02d3f7 54
el17mcd 7:a3ccabdebe2e 55 };
el17mcd 7:a3ccabdebe2e 56