ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19tb

Dependencies:   mbed

Committer:
el19tb
Date:
Thu May 14 05:52:50 2020 +0000
Revision:
19:6d9721ffc078
Parent:
18:6be4c3c94a3d
Child:
27:e2af196bd9ab
fixed bugs for water, safety, and and car lanes, made the water mvoe, improved design

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el19tb 2:86cef2afa648 1 #ifndef CROSSYCHICKEN_H
el19tb 2:86cef2afa648 2 #define CROSSYCHICKEN_H
el19tb 3:648c9d5001be 3
el19tb 2:86cef2afa648 4 #include "mbed.h"
el19tb 2:86cef2afa648 5 #include "N5110.h"
el19tb 2:86cef2afa648 6 #include "Gamepad.h"
el19tb 3:648c9d5001be 7 #include "Chicken.h"
el19tb 3:648c9d5001be 8 #include "Car.h"
el19tb 11:cc5861abfca5 9 #include "Level.h"
el19tb 13:cd6d2f999057 10 #include "Vehicle.h"
el19tb 13:cd6d2f999057 11
el19tb 4:aae7f8d4ab78 12 #include <vector>
el19tb 2:86cef2afa648 13
el19tb 2:86cef2afa648 14
el19tb 17:67dbdfcdcec2 15 struct Water
el19tb 15:b15bf9357cd9 16 {
el19tb 19:6d9721ffc078 17 int x;
el19tb 15:b15bf9357cd9 18 int row;
el19tb 19:6d9721ffc078 19 char c;
el19tb 17:67dbdfcdcec2 20 float speed;
el19tb 19:6d9721ffc078 21 };
el19tb 19:6d9721ffc078 22
el19tb 19:6d9721ffc078 23 struct Safety
el19tb 19:6d9721ffc078 24 {
el19tb 17:67dbdfcdcec2 25 int x;
el19tb 19:6d9721ffc078 26 int row;
el19tb 19:6d9721ffc078 27 char c;
el19tb 19:6d9721ffc078 28 };
el19tb 15:b15bf9357cd9 29
el19tb 2:86cef2afa648 30 class CrossyChicken {
el19tb 11:cc5861abfca5 31 public:
el19tb 11:cc5861abfca5 32
el19tb 11:cc5861abfca5 33 Level *local_level;
el19tb 15:b15bf9357cd9 34 int row_number;
el19tb 18:6be4c3c94a3d 35 int grid_width; // screen width in grid units
el19tb 17:67dbdfcdcec2 36
el19tb 18:6be4c3c94a3d 37 std::vector<Background> roads;
el19tb 19:6d9721ffc078 38 std::vector<Safety> safety_lane;
el19tb 19:6d9721ffc078 39 std::vector<Water> water;
el19tb 18:6be4c3c94a3d 40
el19tb 18:6be4c3c94a3d 41 /*
el19tb 17:67dbdfcdcec2 42 std::vector<Water> row_water_one; // multiple water objects
el19tb 17:67dbdfcdcec2 43 std::vector<Water> row_water_two; // multiple water objects
el19tb 17:67dbdfcdcec2 44 std::vector<Water> row_water_three; // multiple water objects
el19tb 17:67dbdfcdcec2 45 std::vector<Water>::size_type it; // iterator used to fill the vector
el19tb 18:6be4c3c94a3d 46 */
el19tb 13:cd6d2f999057 47 CrossyChicken(Level *level);
el19tb 11:cc5861abfca5 48
el19tb 2:86cef2afa648 49 public:
el19tb 2:86cef2afa648 50 void start();
el19tb 2:86cef2afa648 51 void input();
el19tb 2:86cef2afa648 52 void process_input();
el19tb 2:86cef2afa648 53 void clear();
el19tb 2:86cef2afa648 54
el19tb 2:86cef2afa648 55 void game();
el19tb 2:86cef2afa648 56 void refresh();
el19tb 3:648c9d5001be 57
el19tb 3:648c9d5001be 58 void moveChicken(int xWay, int yWay);
el19tb 3:648c9d5001be 59
el19tb 5:6e3afee7eac3 60 void moveCar(Car *car, int dir, int x);
el19tb 3:648c9d5001be 61 void move();
el19tb 3:648c9d5001be 62
el19tb 3:648c9d5001be 63 void setup();
el19tb 8:52794de935b2 64 void setCollision(Car* object);
el19tb 8:52794de935b2 65 void frogOnLog(Car* car);
el19tb 8:52794de935b2 66 bool returnCollision(Car* log);
el19tb 4:aae7f8d4ab78 67
el19tb 3:648c9d5001be 68 private:
el19tb 2:86cef2afa648 69 };
el19tb 2:86cef2afa648 70
el19tb 2:86cef2afa648 71
el19tb 2:86cef2afa648 72 #endif
el19tb 2:86cef2afa648 73
el19tb 2:86cef2afa648 74
el19tb 2:86cef2afa648 75