ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Committer:
ikenna1
Date:
Wed May 08 15:50:40 2019 +0000
Revision:
43:500b8cff3715
Parent:
41:e1fa36c0492e
Child:
44:a6a361bea806
Test Documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ikenna1 2:66a4e5d7a7cd 1 #ifndef ROSENENGINE_H
ikenna1 2:66a4e5d7a7cd 2 #define ROSENENGINE_H
ikenna1 2:66a4e5d7a7cd 3
ikenna1 2:66a4e5d7a7cd 4 #include "mbed.h"
ikenna1 37:8d8c8cce0bc7 5 #include <ctime>
ikenna1 2:66a4e5d7a7cd 6 #include "N5110.h"
ikenna1 2:66a4e5d7a7cd 7 #include "Gamepad.h"
ikenna1 7:ed5870cfb3e0 8 #include "Ship.h"
ikenna1 9:241a1a7d8527 9 #include "Weapons.h"
ikenna1 9:241a1a7d8527 10 #include "Menu.h"
ikenna1 15:009ccc07bb57 11 #include "Enemy.h"
ikenna1 17:e65a9f981834 12 #include "Health.h"
ikenna1 39:7824f9080f59 13 #include "Lore.h"
ikenna1 2:66a4e5d7a7cd 14
ikenna1 2:66a4e5d7a7cd 15 class RosenEngine
ikenna1 2:66a4e5d7a7cd 16 {
ikenna1 2:66a4e5d7a7cd 17
ikenna1 2:66a4e5d7a7cd 18 public:
ikenna1 2:66a4e5d7a7cd 19 RosenEngine();
ikenna1 2:66a4e5d7a7cd 20 ~RosenEngine();
ikenna1 3:f9cd1a38d5c6 21
ikenna1 8:87a845b8575e 22 void init(int ship_width,int ship_height,int ship_speed,int ship_xpos,int ship_ypos);
ikenna1 27:f99249e727fd 23 void reset();
ikenna1 2:66a4e5d7a7cd 24 void read_input(Gamepad &pad);
ikenna1 2:66a4e5d7a7cd 25 void update(Gamepad &pad);
ikenna1 14:88ca5b1a111a 26 void draw(N5110 &lcd, Gamepad &pad);
ikenna1 9:241a1a7d8527 27 void get_pos();
ikenna1 10:c33d7593a275 28 void title(N5110 &lcd);
ikenna1 13:e114d362186d 29 int get_ycursor();
ikenna1 21:628fb703188f 30 int get_shipno();
ikenna1 43:500b8cff3715 31 SHIP set_shipUsed();
ikenna1 12:47578eb9ea73 32 void ship_select(N5110 &lcd);
ikenna1 36:c25417f0d150 33 void check_health();
ikenna1 38:4571537238ed 34 float timer(int fps);
ikenna1 38:4571537238ed 35 bool dead();
ikenna1 39:7824f9080f59 36 void intro(N5110 &lcd);
ikenna1 40:90c7a893d513 37 Vector2D get_enemynum();
ikenna1 30:711d722f3cef 38
ikenna1 25:faba9eb44514 39 //*** note: add ship width and ship heirgth in place of 6 and 9 to generalize arrays after they are finished
ikenna1 10:c33d7593a275 40
ikenna1 2:66a4e5d7a7cd 41 private:
ikenna1 41:e1fa36c0492e 42 void update_shooter_weapon(Gamepad &pad);
ikenna1 41:e1fa36c0492e 43 void draw_ship(N5110 &lcd, Gamepad &pad);
ikenna1 41:e1fa36c0492e 44 void set_ship_size();
ikenna1 30:711d722f3cef 45 void score(int points);
ikenna1 35:3341f2bd0408 46 bool check_collision(int xpos1, int ypos1,int width1,int height1,int xpos2, int ypos2,int width2,int height2);
ikenna1 35:3341f2bd0408 47 bool check_collision1(int xpos1,int width1,int xpos2,int width2);
ikenna1 35:3341f2bd0408 48 void test();
ikenna1 35:3341f2bd0408 49 void seeker_ship_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 50 void shooter_ship_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 51 void shooterw_ship_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 52 void kestrelw_seeker_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 53 void imperionw_seeker_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 54 void kestrelw_shooter_collision(Gamepad &pad);
ikenna1 35:3341f2bd0408 55 void imperionw_shooter_collision(Gamepad &pad);
ikenna1 40:90c7a893d513 56 void orionw_collision(Gamepad &pad);
ikenna1 38:4571537238ed 57 void scaling(float time_elapsed);
ikenna1 37:8d8c8cce0bc7 58 int rand_no();
ikenna1 38:4571537238ed 59 void game_over(N5110 &lcd);
ikenna1 39:7824f9080f59 60 void disp_points(N5110 &lcd);
ikenna1 39:7824f9080f59 61 void check_se_health();
ikenna1 39:7824f9080f59 62 void check_sh_health();
ikenna1 40:90c7a893d513 63 int range(int x1, int y1, float x2, float y2);
ikenna1 40:90c7a893d513 64 Vector2D find_closest1();
ikenna1 40:90c7a893d513 65 Vector2D find_closest2(int index);
ikenna1 4:740e14ebbc97 66
ikenna1 36:c25417f0d150 67
ikenna1 4:740e14ebbc97 68 // Variables
ikenna1 43:500b8cff3715 69
ikenna1 8:87a845b8575e 70 Ship _ship;
ikenna1 9:241a1a7d8527 71 Weapons _weapons;
ikenna1 9:241a1a7d8527 72 Menu _menu;
ikenna1 15:009ccc07bb57 73 Enemy _enemy;
ikenna1 17:e65a9f981834 74 Health _health;
ikenna1 39:7824f9080f59 75 Lore _lore;
ikenna1 41:e1fa36c0492e 76 Vector2D _joystick;
ikenna1 9:241a1a7d8527 77 Direction _d;
ikenna1 43:500b8cff3715 78 SHIP _shipUsed;
ikenna1 10:c33d7593a275 79 int _ycursor;
ikenna1 21:628fb703188f 80 int _shipno;
ikenna1 30:711d722f3cef 81 int _score;
ikenna1 34:6d0786582d81 82 int _shno;
ikenna1 41:e1fa36c0492e 83 int _shipWidth;
ikenna1 41:e1fa36c0492e 84 int _shipHeight;
ikenna1 41:e1fa36c0492e 85 Vector2D _shipPos;
ikenna1 41:e1fa36c0492e 86 Vector2D _shooterPos[3];
ikenna1 41:e1fa36c0492e 87 Vector2D _shooterWPos[3];
ikenna1 41:e1fa36c0492e 88 Vector2D _seekerPos[3];
ikenna1 34:6d0786582d81 89 Vector2D _coloc;
ikenna1 36:c25417f0d150 90 bool _dead;
ikenna1 38:4571537238ed 91 int _times_run;
ikenna1 38:4571537238ed 92 int _no_shooters;
ikenna1 39:7824f9080f59 93 int _no_seekers;
ikenna1 39:7824f9080f59 94 bool _intro;
ikenna1 39:7824f9080f59 95 float _wait_time;
ikenna1 25:faba9eb44514 96
ikenna1 2:66a4e5d7a7cd 97
ikenna1 2:66a4e5d7a7cd 98 };
ikenna1 25:faba9eb44514 99 /************STUFF TO FIX******************************
ikenna1 28:6319e928f0aa 100 **** add sound effects for sjield braking
ikenna1 28:6319e928f0aa 101 **** add passive shield regeneration
ikenna1 29:4c7b16b5b6df 102 **** work on score increase
ikenna1 29:4c7b16b5b6df 103 **** add title screen with name
ikenna1 29:4c7b16b5b6df 104 **** make it so back asks you if you are sure and ststes that you will lose all progress
ikenna1 29:4c7b16b5b6df 105 **** think of level system
ikenna1 29:4c7b16b5b6df 106 **** orion should send out pulses that stun enemy ships and absorb thier shields(use draw line)
ikenna1 29:4c7b16b5b6df 107 **** scale shields properly
ikenna1 29:4c7b16b5b6df 108 **** fix the border issue(i.e the ships clip through healthbar)
ikenna1 30:711d722f3cef 109 **** make it so enemy ship spawning is random use srand
ikenna1 34:6d0786582d81 110 **** add in options for lcd brightness and contrast
ikenna1 34:6d0786582d81 111 **** add in cheats
ikenna1 34:6d0786582d81 112 ****
ikenna1 25:faba9eb44514 113 */
ikenna1 35:3341f2bd0408 114 #endif
ikenna1 35:3341f2bd0408 115 /*
ikenna1 36:c25417f0d150 116 changes not commited
ikenna1 36:c25417f0d150 117 *Fix game playing in background
ikenna1 36:c25417f0d150 118 *Change seeker damage to 175
ikenna1 36:c25417f0d150 119 *make seeker health 5
ikenna1 36:c25417f0d150 120 * implement a viewing system for enemy ships
ikenna1 36:c25417f0d150 121 * enemy comes from below very fast
ikenna1 36:c25417f0d150 122 * if you hold a button shields come up in front but not sides
ikenna1 36:c25417f0d150 123 *
ikenna1 36:c25417f0d150 124 *
ikenna1 35:3341f2bd0408 125 */