yumaowei 201377547

Dependencies:   mbed ELEC2645_Project_el17my

Committer:
yumaowei
Date:
Tue May 26 07:24:21 2020 +0000
Revision:
2:5e54476c518f
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yumaowei 2:5e54476c518f 1 #ifndef HUNTENGINE_H
yumaowei 2:5e54476c518f 2 #define HUNTENGINE_H
yumaowei 2:5e54476c518f 3
yumaowei 2:5e54476c518f 4 #include "mbed.h"
yumaowei 2:5e54476c518f 5 #include "LCD.h"
yumaowei 2:5e54476c518f 6 #include "Gamepad.h"
yumaowei 2:5e54476c518f 7 #include "Prey.h"
yumaowei 2:5e54476c518f 8 #include "Predator.h"
yumaowei 2:5e54476c518f 9
yumaowei 2:5e54476c518f 10 /** Prey Class
yumaowei 2:5e54476c518f 11 @author Maowei Yu, University of Leeds
yumaowei 2:5e54476c518f 12 @details This is the engine of predator_prey game.
yumaowei 2:5e54476c518f 13 @details the class controls the prey and predator component in the game
yumaowei 2:5e54476c518f 14 @date May 2020
yumaowei 2:5e54476c518f 15 */
yumaowei 2:5e54476c518f 16 // gap from edge of screen
yumaowei 2:5e54476c518f 17 #define GAP 2
yumaowei 2:5e54476c518f 18
yumaowei 2:5e54476c518f 19 class HuntEngine
yumaowei 2:5e54476c518f 20 {
yumaowei 2:5e54476c518f 21
yumaowei 2:5e54476c518f 22 public:
yumaowei 2:5e54476c518f 23 HuntEngine();
yumaowei 2:5e54476c518f 24 ~HuntEngine();
yumaowei 2:5e54476c518f 25
yumaowei 2:5e54476c518f 26 void init(int predator_radius,int prey_size,int speed);
yumaowei 2:5e54476c518f 27 void read_input(Gamepad &pad);
yumaowei 2:5e54476c518f 28 void update(Gamepad &pad);
yumaowei 2:5e54476c518f 29 void draw(LCD &lcd);
yumaowei 2:5e54476c518f 30
yumaowei 2:5e54476c518f 31 private:
yumaowei 2:5e54476c518f 32
yumaowei 2:5e54476c518f 33 void check_wall_collision(Gamepad &pad);
yumaowei 2:5e54476c518f 34 void check_predator_collisions(Gamepad &pad);
yumaowei 2:5e54476c518f 35 void check_catch(Gamepad &pad);
yumaowei 2:5e54476c518f 36 void print_points(LCD &lcd);
yumaowei 2:5e54476c518f 37
yumaowei 2:5e54476c518f 38 Predator _predator;
yumaowei 2:5e54476c518f 39
yumaowei 2:5e54476c518f 40 int _predator_radius;
yumaowei 2:5e54476c518f 41 int _prey_size;
yumaowei 2:5e54476c518f 42 int _speed;
yumaowei 2:5e54476c518f 43
yumaowei 2:5e54476c518f 44 // x positions of the predator
yumaowei 2:5e54476c518f 45 int _px;
yumaowei 2:5e54476c518f 46
yumaowei 2:5e54476c518f 47
yumaowei 2:5e54476c518f 48 Prey _prey;
yumaowei 2:5e54476c518f 49
yumaowei 2:5e54476c518f 50 Direction _d;
yumaowei 2:5e54476c518f 51 float _mag;
yumaowei 2:5e54476c518f 52
yumaowei 2:5e54476c518f 53 };
yumaowei 2:5e54476c518f 54
yumaowei 2:5e54476c518f 55 #endif