ELEC2645 (2018/19) / Mbed 2 deprecated 2645_Project_SiutingWong201186503

Dependencies:   mbed

Committer:
davidwst421
Date:
Thu May 09 06:19:58 2019 +0000
Revision:
14:13e82f720bea
Parent:
13:c3c58d50a571
Child:
15:749c595b19e2
final version with full comment on most functions/variables

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davidwst421 0:fd8eda608206 1 #ifndef ENGINE_H
davidwst421 0:fd8eda608206 2 #define ENGINE_H
davidwst421 0:fd8eda608206 3
davidwst421 0:fd8eda608206 4 #include "mbed.h"
davidwst421 0:fd8eda608206 5 #include "N5110.h"
davidwst421 0:fd8eda608206 6 #include "Gamepad.h"
davidwst421 0:fd8eda608206 7 #include "Stone.h"
davidwst421 0:fd8eda608206 8 #include "Avenger.h"
davidwst421 0:fd8eda608206 9 #include "Wall.h"
davidwst421 0:fd8eda608206 10
davidwst421 0:fd8eda608206 11 class Engine
davidwst421 0:fd8eda608206 12 {
davidwst421 0:fd8eda608206 13
davidwst421 0:fd8eda608206 14 public:
davidwst421 0:fd8eda608206 15 Engine();
davidwst421 0:fd8eda608206 16 ~Engine();
davidwst421 7:193c0fd7afdd 17 void init(int wall_width,int wall_gap,int stone_size,int speed);
davidwst421 0:fd8eda608206 18 void read_input(Gamepad &pad);
davidwst421 0:fd8eda608206 19 void draw(N5110 &lcd);
davidwst421 0:fd8eda608206 20 void update(Gamepad &pad);
davidwst421 14:13e82f720bea 21 int get_score(); // get score for the incoming events
davidwst421 0:fd8eda608206 22
davidwst421 0:fd8eda608206 23 private:
davidwst421 0:fd8eda608206 24
davidwst421 0:fd8eda608206 25 void check_wall_collision(Gamepad &pad);
davidwst421 0:fd8eda608206 26 void check_score(Gamepad &pad);
davidwst421 0:fd8eda608206 27
davidwst421 0:fd8eda608206 28 Wall _w0;
davidwst421 0:fd8eda608206 29 Wall _w1;
davidwst421 0:fd8eda608206 30 Wall _w2;
davidwst421 0:fd8eda608206 31 Wall _w3;
davidwst421 0:fd8eda608206 32 Wall _w4;
davidwst421 0:fd8eda608206 33
davidwst421 0:fd8eda608206 34 int _wall_width;
davidwst421 0:fd8eda608206 35 int _wall_gap;
davidwst421 0:fd8eda608206 36 int _stone_size;
davidwst421 0:fd8eda608206 37 int _speed;
davidwst421 0:fd8eda608206 38
davidwst421 14:13e82f720bea 39 // x positions of the walls
davidwst421 0:fd8eda608206 40 int _w0x;
davidwst421 0:fd8eda608206 41 int _w1x;
davidwst421 0:fd8eda608206 42 int _w2x;
davidwst421 0:fd8eda608206 43 int _w3x;
davidwst421 0:fd8eda608206 44 int _w4x;
davidwst421 0:fd8eda608206 45 int _avengerx;
davidwst421 0:fd8eda608206 46 int _stonex;
davidwst421 0:fd8eda608206 47
davidwst421 0:fd8eda608206 48 Avenger _avenger;
davidwst421 0:fd8eda608206 49 Stone _stone;
davidwst421 0:fd8eda608206 50
davidwst421 0:fd8eda608206 51 Direction _d;
davidwst421 0:fd8eda608206 52 float _mag;
davidwst421 6:a0f3dbbc8d33 53 Vector2D _mapped_coord;
davidwst421 6:a0f3dbbc8d33 54
davidwst421 0:fd8eda608206 55
davidwst421 0:fd8eda608206 56 };
davidwst421 0:fd8eda608206 57
davidwst421 0:fd8eda608206 58 #endif