ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Committer:
el17m2h
Date:
Wed Apr 24 12:43:52 2019 +0000
Revision:
18:9f40a2f8c2c5
Parent:
17:74de8c17ddac
Child:
19:5a7b0cdf013b
Fixed the function so that it shoots a bullet at a time, by making the engine read the button instead of it being read inside of the bullet file. ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17m2h 2:360a6c301a4e 1 #ifndef ENGINE_H
el17m2h 2:360a6c301a4e 2 #define ENGINE_H
el17m2h 2:360a6c301a4e 3
el17m2h 2:360a6c301a4e 4 #include "mbed.h"
el17m2h 2:360a6c301a4e 5 #include "N5110.h"
el17m2h 2:360a6c301a4e 6 #include "Gamepad.h"
el17m2h 2:360a6c301a4e 7 #include "Floors.h"
el17m2h 4:8ec314f806ae 8 #include "Doodler.h"
el17m2h 17:74de8c17ddac 9 #include "Bullet.h"
el17m2h 2:360a6c301a4e 10
el17m2h 2:360a6c301a4e 11 class Engine{
el17m2h 2:360a6c301a4e 12 public:
el17m2h 2:360a6c301a4e 13 Engine();
el17m2h 2:360a6c301a4e 14 ~Engine();
el17m2h 4:8ec314f806ae 15 void init(int floors_width, int floors_height, int doodler_radius);
el17m2h 5:8814d6de77d0 16 void read_input(Gamepad &pad);
el17m2h 5:8814d6de77d0 17 void update(Gamepad &pad);
el17m2h 2:360a6c301a4e 18 void draw(N5110 &lcd);
el17m2h 14:529f798adae4 19 void check_floors_collision();
el17m2h 4:8ec314f806ae 20
el17m2h 7:0d9cee90ab0d 21 private:
el17m2h 18:9f40a2f8c2c5 22 Bullet _b;
el17m2h 18:9f40a2f8c2c5 23 float _bullet_pos_x;
el17m2h 18:9f40a2f8c2c5 24 float _bullet_pos_y;
el17m2h 16:e0542761fc8c 25
el17m2h 14:529f798adae4 26 Floors _f;
el17m2h 14:529f798adae4 27 Floors _f1;
el17m2h 14:529f798adae4 28 Floors _f2;
el17m2h 14:529f798adae4 29 Floors _f3;
el17m2h 14:529f798adae4 30 Floors _f4;
el17m2h 14:529f798adae4 31 Floors _f5;
el17m2h 14:529f798adae4 32 Floors _f6;
el17m2h 14:529f798adae4 33 Floors _f7;
el17m2h 14:529f798adae4 34 Floors _f8;
el17m2h 14:529f798adae4 35 Floors _f9;
el17m2h 4:8ec314f806ae 36
el17m2h 2:360a6c301a4e 37 int _floors_height;
el17m2h 2:360a6c301a4e 38 int _floors_width;
el17m2h 4:8ec314f806ae 39
el17m2h 2:360a6c301a4e 40 // x and y positions of the floors
el17m2h 9:5e53bca2a4c2 41 Vector2D _f_pos;
el17m2h 11:2041290b5a74 42 Vector2D _f1_pos;
el17m2h 11:2041290b5a74 43 Vector2D _f2_pos;
el17m2h 11:2041290b5a74 44 Vector2D _f3_pos;
el17m2h 11:2041290b5a74 45 Vector2D _f4_pos;
el17m2h 11:2041290b5a74 46 Vector2D _f5_pos;
el17m2h 11:2041290b5a74 47 Vector2D _f6_pos;
el17m2h 11:2041290b5a74 48 Vector2D _f7_pos;
el17m2h 11:2041290b5a74 49 Vector2D _f8_pos;
el17m2h 11:2041290b5a74 50 Vector2D _f9_pos;
el17m2h 5:8814d6de77d0 51
el17m2h 5:8814d6de77d0 52 Doodler _dood;
el17m2h 11:2041290b5a74 53 int _doodler_radius;
el17m2h 11:2041290b5a74 54 float _doodler_pos_x;
el17m2h 11:2041290b5a74 55 float _doodler_pos_y;
el17m2h 11:2041290b5a74 56 float _doodler_vel_x;
el17m2h 18:9f40a2f8c2c5 57 double _doodler_vel_y;
el17m2h 17:74de8c17ddac 58
el17m2h 5:8814d6de77d0 59 Direction _d;
el17m2h 5:8814d6de77d0 60 float _mag;
el17m2h 16:e0542761fc8c 61 bool _button_A;
el17m2h 16:e0542761fc8c 62 bool _button_B;
el17m2h 16:e0542761fc8c 63 bool _button_X;
el17m2h 16:e0542761fc8c 64 bool _button_Y;
el17m2h 2:360a6c301a4e 65 };
el17m2h 2:360a6c301a4e 66 #endif