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

Dependencies:   mbed

Committer:
davidwst421
Date:
Wed May 08 20:49:24 2019 +0000
Revision:
4:fcd80b40f257
Parent:
0:fd8eda608206
Child:
6:a0f3dbbc8d33
lower the collision size of the stone to remove multiple triggers on the same object

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 0:fd8eda608206 17 void init(int wall_width,int wall_gap,int avenger_size,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 4:fcd80b40f257 21 int get_score();
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 void print_score(N5110 &lcd);
davidwst421 0:fd8eda608206 28
davidwst421 0:fd8eda608206 29 Wall _w0;
davidwst421 0:fd8eda608206 30 Wall _w1;
davidwst421 0:fd8eda608206 31 Wall _w2;
davidwst421 0:fd8eda608206 32 Wall _w3;
davidwst421 0:fd8eda608206 33 Wall _w4;
davidwst421 0:fd8eda608206 34
davidwst421 0:fd8eda608206 35 int _wall_width;
davidwst421 0:fd8eda608206 36 int _wall_gap;
davidwst421 0:fd8eda608206 37 int _avenger_size;
davidwst421 0:fd8eda608206 38 int _stone_size;
davidwst421 0:fd8eda608206 39 int _speed;
davidwst421 0:fd8eda608206 40
davidwst421 0:fd8eda608206 41 // x positions of the paddles
davidwst421 0:fd8eda608206 42 int _w0x;
davidwst421 0:fd8eda608206 43 int _w1x;
davidwst421 0:fd8eda608206 44 int _w2x;
davidwst421 0:fd8eda608206 45 int _w3x;
davidwst421 0:fd8eda608206 46 int _w4x;
davidwst421 0:fd8eda608206 47 int _avengerx;
davidwst421 0:fd8eda608206 48 int _stonex;
davidwst421 0:fd8eda608206 49
davidwst421 0:fd8eda608206 50 Avenger _avenger;
davidwst421 0:fd8eda608206 51 Stone _stone;
davidwst421 0:fd8eda608206 52
davidwst421 0:fd8eda608206 53 Direction _d;
davidwst421 0:fd8eda608206 54 float _mag;
davidwst421 0:fd8eda608206 55
davidwst421 0:fd8eda608206 56 };
davidwst421 0:fd8eda608206 57
davidwst421 0:fd8eda608206 58 #endif