ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Committer:
el17m2h
Date:
Wed May 08 08:46:11 2019 +0000
Revision:
23:9be87557b89a
Parent:
22:0d2ac98a8b48
Child:
24:67dc71a8f009
Added a sprite for the doodler and the enemy.

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 22:0d2ac98a8b48 4 #include <iostream>
el17m2h 2:360a6c301a4e 5 #include "mbed.h"
el17m2h 2:360a6c301a4e 6 #include "N5110.h"
el17m2h 2:360a6c301a4e 7 #include "Gamepad.h"
el17m2h 2:360a6c301a4e 8 #include "Floors.h"
el17m2h 4:8ec314f806ae 9 #include "Doodler.h"
el17m2h 17:74de8c17ddac 10 #include "Bullet.h"
el17m2h 2:360a6c301a4e 11
el17m2h 2:360a6c301a4e 12 class Engine{
el17m2h 2:360a6c301a4e 13 public:
el17m2h 2:360a6c301a4e 14 Engine();
el17m2h 2:360a6c301a4e 15 ~Engine();
el17m2h 23:9be87557b89a 16 void init(int floors_width, int floors_height);
el17m2h 23:9be87557b89a 17 void screen_init();
el17m2h 5:8814d6de77d0 18 void read_input(Gamepad &pad);
el17m2h 5:8814d6de77d0 19 void update(Gamepad &pad);
el17m2h 2:360a6c301a4e 20 void draw(N5110 &lcd);
el17m2h 22:0d2ac98a8b48 21 void check_floors_collision(float doodler_pos_x, float doodler_pos_y);
el17m2h 23:9be87557b89a 22 void check_fire(Gamepad &pad, float updated_doodler_pos_x, float updated_doodler_pos_y, float doodler_pos_y);
el17m2h 21:6b16ca9834e6 23 void add_score();
el17m2h 21:6b16ca9834e6 24 void print_score(N5110 &lcd);
el17m2h 4:8ec314f806ae 25
el17m2h 19:5a7b0cdf013b 26 private:
el17m2h 18:9f40a2f8c2c5 27 Bullet _b;
el17m2h 19:5a7b0cdf013b 28 float _b_pos_x;
el17m2h 19:5a7b0cdf013b 29 float _b_pos_y;
el17m2h 21:6b16ca9834e6 30
el17m2h 21:6b16ca9834e6 31 int _score;
el17m2h 19:5a7b0cdf013b 32
el17m2h 23:9be87557b89a 33 Floors _f[6]; // array of 6 floors
el17m2h 4:8ec314f806ae 34
el17m2h 2:360a6c301a4e 35 int _floors_height;
el17m2h 2:360a6c301a4e 36 int _floors_width;
el17m2h 4:8ec314f806ae 37
el17m2h 2:360a6c301a4e 38 // x and y positions of the floors
el17m2h 23:9be87557b89a 39 Vector2D _f_pos[6]; //
el17m2h 5:8814d6de77d0 40
el17m2h 5:8814d6de77d0 41 Doodler _dood;
el17m2h 11:2041290b5a74 42 float _doodler_pos_x;
el17m2h 11:2041290b5a74 43 float _doodler_pos_y;
el17m2h 19:5a7b0cdf013b 44 float _updated_doodler_pos_x;
el17m2h 19:5a7b0cdf013b 45 float _updated_doodler_pos_y;
el17m2h 11:2041290b5a74 46 float _doodler_vel_x;
el17m2h 18:9f40a2f8c2c5 47 double _doodler_vel_y;
el17m2h 23:9be87557b89a 48 float distance_y[6];
el17m2h 17:74de8c17ddac 49
el17m2h 19:5a7b0cdf013b 50 int _screen_pos_x;
el17m2h 19:5a7b0cdf013b 51 int _screen_pos_y;
el17m2h 19:5a7b0cdf013b 52 int _screen_width;
el17m2h 19:5a7b0cdf013b 53 int _screen_height;
el17m2h 19:5a7b0cdf013b 54
el17m2h 5:8814d6de77d0 55 Direction _d;
el17m2h 5:8814d6de77d0 56 float _mag;
el17m2h 16:e0542761fc8c 57 bool _button_A;
el17m2h 16:e0542761fc8c 58 bool _button_B;
el17m2h 16:e0542761fc8c 59 bool _button_X;
el17m2h 16:e0542761fc8c 60 bool _button_Y;
el17m2h 2:360a6c301a4e 61 };
el17m2h 2:360a6c301a4e 62 #endif