ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Committer:
el17m2h
Date:
Thu Apr 25 08:43:46 2019 +0000
Revision:
19:5a7b0cdf013b
Parent:
18:9f40a2f8c2c5
Child:
20:a359092079b0
Added a game over function to the main file so that once the doodler hits the floor the game is finalized.

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 19:5a7b0cdf013b 21 private:
el17m2h 18:9f40a2f8c2c5 22 Bullet _b;
el17m2h 19:5a7b0cdf013b 23 float _b_pos_x;
el17m2h 19:5a7b0cdf013b 24 float _b_pos_y;
el17m2h 19:5a7b0cdf013b 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 19:5a7b0cdf013b 56 float _updated_doodler_pos_x;
el17m2h 19:5a7b0cdf013b 57 float _updated_doodler_pos_y;
el17m2h 11:2041290b5a74 58 float _doodler_vel_x;
el17m2h 18:9f40a2f8c2c5 59 double _doodler_vel_y;
el17m2h 17:74de8c17ddac 60
el17m2h 19:5a7b0cdf013b 61 int _screen_pos_x;
el17m2h 19:5a7b0cdf013b 62 int _screen_pos_y;
el17m2h 19:5a7b0cdf013b 63 int _screen_width;
el17m2h 19:5a7b0cdf013b 64 int _screen_height;
el17m2h 19:5a7b0cdf013b 65
el17m2h 5:8814d6de77d0 66 Direction _d;
el17m2h 5:8814d6de77d0 67 float _mag;
el17m2h 16:e0542761fc8c 68 bool _button_A;
el17m2h 16:e0542761fc8c 69 bool _button_B;
el17m2h 16:e0542761fc8c 70 bool _button_X;
el17m2h 16:e0542761fc8c 71 bool _button_Y;
el17m2h 2:360a6c301a4e 72 };
el17m2h 2:360a6c301a4e 73 #endif