ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Committer:
el17m2h
Date:
Wed May 08 14:24:53 2019 +0000
Revision:
24:67dc71a8f009
Parent:
23:9be87557b89a
Child:
26:d16a5b1e0ace
Added comments to the doodler h file.

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 24:67dc71a8f009 12 /** Engine class
el17m2h 24:67dc71a8f009 13 @brief Class for the engine of the game
el17m2h 24:67dc71a8f009 14 @author Melissa Hartmann
el17m2h 24:67dc71a8f009 15 @date May 2019
el17m2h 24:67dc71a8f009 16 */
el17m2h 2:360a6c301a4e 17 class Engine{
el17m2h 2:360a6c301a4e 18 public:
el17m2h 2:360a6c301a4e 19 Engine();
el17m2h 2:360a6c301a4e 20 ~Engine();
el17m2h 24:67dc71a8f009 21
el17m2h 24:67dc71a8f009 22 /**
el17m2h 24:67dc71a8f009 23 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 24 @param float dood_pos_x
el17m2h 24:67dc71a8f009 25 @param float dood_pos_y
el17m2h 24:67dc71a8f009 26 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 27 */
el17m2h 23:9be87557b89a 28 void init(int floors_width, int floors_height);
el17m2h 24:67dc71a8f009 29
el17m2h 24:67dc71a8f009 30 /**
el17m2h 24:67dc71a8f009 31 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 32 @param float dood_pos_x
el17m2h 24:67dc71a8f009 33 @param float dood_pos_y
el17m2h 24:67dc71a8f009 34 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 35 */
el17m2h 23:9be87557b89a 36 void screen_init();
el17m2h 24:67dc71a8f009 37
el17m2h 24:67dc71a8f009 38 /**
el17m2h 24:67dc71a8f009 39 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 40 @param float dood_pos_x
el17m2h 24:67dc71a8f009 41 @param float dood_pos_y
el17m2h 24:67dc71a8f009 42 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 43 */
el17m2h 5:8814d6de77d0 44 void read_input(Gamepad &pad);
el17m2h 24:67dc71a8f009 45
el17m2h 24:67dc71a8f009 46 /**
el17m2h 24:67dc71a8f009 47 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 48 @param float dood_pos_x
el17m2h 24:67dc71a8f009 49 @param float dood_pos_y
el17m2h 24:67dc71a8f009 50 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 51 */
el17m2h 5:8814d6de77d0 52 void update(Gamepad &pad);
el17m2h 24:67dc71a8f009 53
el17m2h 24:67dc71a8f009 54 /**
el17m2h 24:67dc71a8f009 55 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 56 @param float dood_pos_x
el17m2h 24:67dc71a8f009 57 @param float dood_pos_y
el17m2h 24:67dc71a8f009 58 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 59 */
el17m2h 2:360a6c301a4e 60 void draw(N5110 &lcd);
el17m2h 24:67dc71a8f009 61
el17m2h 24:67dc71a8f009 62 /**
el17m2h 24:67dc71a8f009 63 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 64 @param float dood_pos_x
el17m2h 24:67dc71a8f009 65 @param float dood_pos_y
el17m2h 24:67dc71a8f009 66 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 67 */
el17m2h 24:67dc71a8f009 68 void check_floors_collision(float doodler_pos_x, float doodler_pos_y, double doodler_vel_y);
el17m2h 24:67dc71a8f009 69
el17m2h 24:67dc71a8f009 70 /**
el17m2h 24:67dc71a8f009 71 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 72 @param float dood_pos_x
el17m2h 24:67dc71a8f009 73 @param float dood_pos_y
el17m2h 24:67dc71a8f009 74 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 75 */
el17m2h 23:9be87557b89a 76 void check_fire(Gamepad &pad, float updated_doodler_pos_x, float updated_doodler_pos_y, float doodler_pos_y);
el17m2h 24:67dc71a8f009 77
el17m2h 24:67dc71a8f009 78 /**
el17m2h 24:67dc71a8f009 79 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 80 @param float dood_pos_x
el17m2h 24:67dc71a8f009 81 @param float dood_pos_y
el17m2h 24:67dc71a8f009 82 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 83 */
el17m2h 21:6b16ca9834e6 84 void add_score();
el17m2h 24:67dc71a8f009 85
el17m2h 24:67dc71a8f009 86 /**
el17m2h 24:67dc71a8f009 87 @brief defines the initial position of the bullet
el17m2h 24:67dc71a8f009 88 @param float dood_pos_x
el17m2h 24:67dc71a8f009 89 @param float dood_pos_y
el17m2h 24:67dc71a8f009 90 @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position)
el17m2h 24:67dc71a8f009 91 */
el17m2h 21:6b16ca9834e6 92 void print_score(N5110 &lcd);
el17m2h 4:8ec314f806ae 93
el17m2h 19:5a7b0cdf013b 94 private:
el17m2h 18:9f40a2f8c2c5 95 Bullet _b;
el17m2h 19:5a7b0cdf013b 96 float _b_pos_x;
el17m2h 19:5a7b0cdf013b 97 float _b_pos_y;
el17m2h 21:6b16ca9834e6 98
el17m2h 21:6b16ca9834e6 99 int _score;
el17m2h 19:5a7b0cdf013b 100
el17m2h 23:9be87557b89a 101 Floors _f[6]; // array of 6 floors
el17m2h 4:8ec314f806ae 102
el17m2h 2:360a6c301a4e 103 int _floors_height;
el17m2h 2:360a6c301a4e 104 int _floors_width;
el17m2h 4:8ec314f806ae 105
el17m2h 2:360a6c301a4e 106 // x and y positions of the floors
el17m2h 23:9be87557b89a 107 Vector2D _f_pos[6]; //
el17m2h 5:8814d6de77d0 108
el17m2h 5:8814d6de77d0 109 Doodler _dood;
el17m2h 24:67dc71a8f009 110 float doodler_pos_x;
el17m2h 24:67dc71a8f009 111 float doodler_pos_y;
el17m2h 24:67dc71a8f009 112 float updated_doodler_pos_x;
el17m2h 24:67dc71a8f009 113 float updated_doodler_pos_y;
el17m2h 24:67dc71a8f009 114 float doodler_vel_x;
el17m2h 24:67dc71a8f009 115 double doodler_vel_y;
el17m2h 23:9be87557b89a 116 float distance_y[6];
el17m2h 17:74de8c17ddac 117
el17m2h 19:5a7b0cdf013b 118 int _screen_pos_x;
el17m2h 19:5a7b0cdf013b 119 int _screen_pos_y;
el17m2h 19:5a7b0cdf013b 120 int _screen_width;
el17m2h 19:5a7b0cdf013b 121 int _screen_height;
el17m2h 19:5a7b0cdf013b 122
el17m2h 5:8814d6de77d0 123 Direction _d;
el17m2h 5:8814d6de77d0 124 float _mag;
el17m2h 16:e0542761fc8c 125 bool _button_A;
el17m2h 16:e0542761fc8c 126 bool _button_B;
el17m2h 16:e0542761fc8c 127 bool _button_X;
el17m2h 16:e0542761fc8c 128 bool _button_Y;
el17m2h 2:360a6c301a4e 129 };
el17m2h 2:360a6c301a4e 130 #endif