Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Gamepad N5110 mbed-rtos
Revision 0:d9cf94b41df3, committed 2019-05-09
- Comitter:
- RexRoshan
- Date:
- Thu May 09 09:49:35 2019 +0000
- Commit message:
- Documentation has been completed and the code has been slightly modified
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Background/Background.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,120 @@ +#include "Background.h" + +// nothing doing in the constructor and destructor +Background::Background() +{ + +} + +Background::~Background() +{ + +} + +// upper cloud + +int upper_cloud [18][16] = { + +{1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, +{1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, +{0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0}, +{0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0}, +{0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0}, +{0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0}, +{0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0}, +{0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0}, +{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, +{1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, +{1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0}, +{0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0}, +{0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0}, +{0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0}, +{0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0}, +{0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, + +}; + +int lower_cloud [16][17] = { +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1}, +{0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,1,0}, +{0,0,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0}, +{0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0}, +{1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, +{1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, +{1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, +{0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0}, +{0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, +{0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, +{1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, +{1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, +{0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, + +}; + + +void Background::init_u(int a,int b) // initialising the x and y position of the clouds +{ + + _a = a; // x position of the upper cloud + _b = b; // y position of the upper cloud + +} + +void Background::init_l(int c,int d) // initialising the x and y position of the clouds +{ + + _c = c; // x position of the lower cloud + _d = d; // y position of the lower cloud + +} + +void Background::background(N5110 &lcd) +{ + + // Draws the clouds + lcd.drawSprite(_a,_b,18,16,(int *)upper_cloud); + lcd.drawSprite(_c, _d, 16, 17, (int *)lower_cloud); +} + +void Background::update() // Moves the position of the cloud everytime +{ + + _fast = 1.0; // Movement speed = 1 so that it is not too fast + + _a+=_fast; + _c+=_fast; // moves the x-position to the right + + +} + + +Vector2D Background::get_pos_upper() { + //gets the position of the clouds + Vector2D e = {_a,_b}; + return e; +} + +Vector2D Background::get_pos_lower() { + //gets the position of the clouds + Vector2D f = {_c,_d}; + return f; +} + +void Background::set_pos_upper(Vector2D e) +{ + //sets the position of the first enemy of stage 2 + _a = e.x; + _b = e.y; +} + +void Background::set_pos_lower(Vector2D f) +{ + //sets the position of the first enemy of stage 2 + _c = f.x; + _d = f.y; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Background/Background.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,76 @@ +#ifndef BACKGROUND_H +#define BACKGROUND_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +/** Background Class + * @brief Shows the background of the minigame + * @author Rex Roshan Raj + */ +class Background +{ + +public: + /** Constructor */ + Background(); + + /** Destructor */ + ~Background(); + + /** Initialise the parameters for background in minigame + *@param a - x position of the upper cloud + *@param b - y position of the upper cloud + */ + void init_u(int a,int b); + + /** Initialise the parameters for background in minigame + *@param c - x position of the lower cloud + *@param d - y position of the lower cloud + */ + void init_l(int c, int d); + + /** Draws the enemy + * @param N5110 lcd + * @brief Draws the enemy in stage one + */ + void background(N5110 &lcd); + + /** Updates the movement + * @brief Changes the y position for animation once the enemy has died + */ + void update(); + + /** Gets the position of the upper cloud + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_upper(); + + /** Gets the position of the lower cloud + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_lower(); + + /** Sets the position of the upper cloud + * @param position of the upper cloud + */ + void set_pos_upper(Vector2D e); + + /** Sets the position of the lower cloud + * @param position of the lower cloud + */ + void set_pos_lower(Vector2D e); + +private: + + // methods + int _a; + int _b; + int _c; + int _d; + int _fast; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,98 @@ +#include "Enemy.h" + +// nothing doing in the constructor and destructor +Enemy::Enemy() +{ + +} + +Enemy::~Enemy() +{ + +} + +// first enemy sprite +int enemy1 [7][8] = { + +{0,1,1,0,0,0,0,1}, +{0,0,0,1,1,1,1,1}, +{0,0,1,0,0,1,1,0}, +{0,1,0,0,1,1,1,0}, +{0,0,1,0,0,1,1,0}, +{0,0,0,1,1,1,1,1}, +{0,1,1,0,0,0,0,1}, + +}; + + +void Enemy::init(int a,int b) // initialising the x and y position of the enemy +{ + + _a = a; // x position of the enemy + _b = b; // y position of the enemy + _health = 0; // start health from zero + +} + +void Enemy::location() +{ + int _speed = 5; // distance the enemy moves + srand(time(NULL)); + int direction = rand() % 4; // randomise initial direction. + + // 4 possibilities. Get random modulo and set location accordingly + if (direction == 0) { // North + _a = _a; + _b += _speed; + } else if (direction == 1) { //South + _a = _a; + _b -= _speed; + } else if (direction == 2) { //West + _a -= _speed; + _b = _b; + } else { // East + _a += _speed; + _b = _b; + } +} + +void Enemy::enemy(N5110 &lcd) +{ + + // Draws the first enemy + lcd.drawSprite(_a,_b,7,8,(int *)enemy1); +} + +void Enemy::update() // Moves the position of the enemy when the enemy dies +{ + + _fast = 2.0; // Movement speed = 2 so that it is not too fast + + _b+=_speed; // moves the y-position downwards + + +} +void Enemy::add_health() +{ + // adds health + _health++; +} +int Enemy::get_health() +{ + // gets the value of health + return _health; +} + + +Vector2D Enemy::get_enemy_pos() { + //gets the position of the first enemy + Vector2D e = {_a,_b}; + return e; +} + +void Enemy::set_enemy_pos(Vector2D e) +{ + //sets the position of the first enemy of stage 2 + _a = e.x; + _b = e.y; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,73 @@ +#ifndef ENEMY_H +#define ENEMY_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +/** Enemy Class + * @brief Enemy for stage one + * @author Rex Roshan Raj + */ +class Enemy +{ + +public: + /** Constructor */ + Enemy(); + + /** Destructor */ + ~Enemy(); + + /** Initialise all the parameters for enemy in stage one + *@param a - x position of the enemy + *@param b - y position of the enemy + */ + void init(int a,int b); + + /** Generates the location + * @brief Generates and sets the location of the enemy once it has been hit + */ + void location(); + + /** Draws the enemy + * @param N5110 lcd + * @brief Draws the enemy in stage one + */ + void enemy(N5110 &lcd); + + /** Updates the movement + * @brief Changes the y position for animation once the enemy has died + */ + void update(); + + /** Adds the value of health by 1 */ + void add_health(); + + /** Gets the value of the health + * @returns value in range 0 to 10 + */ + int get_health(); + + /** Gets the position of the enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy_pos(); + + /** Sets the position of the enemy + * @param position of the enemy + */ + void set_enemy_pos(Vector2D e); + +private: + + // methods + int _a; + int _b; + int _speed; + int _fast; + int _health; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy21.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,101 @@ +#include "Enemy21.h" + +// nothing doing in the constructor and destructor +Enemy21::Enemy21() +{ + +} + +Enemy21::~Enemy21() +{ + +} + +// sprite of the first enemy for stage 2 +int enemy21 [7][7] ={ + +{0,0,0,0,0,1,1}, +{0,0,0,0,0,1,1}, +{0,0,0,0,1,0,0}, +{0,0,0,1,0,0,0}, +{0,0,1,0,0,0,0}, +{1,1,0,0,0,0,0}, +{1,1,0,0,0,0,0}, + +}; + +void Enemy21::init(int a,int b,int speed) // initialising the x and y position of the enemy and movement speed of the enemy +{ + + _a = a; // x position of the first enemy for stage 2 + _b = b; // y position of the first enemy for stage 2 + + _health = 0; // start health from zero + + int direction = rand() % 2; // randomise initial direction. + + // 2 possibilities. Get random modulo and set movement accordingly + if (direction == 0) { + _movement.x = 0; + _movement.y = speed; // move up + } else { + _movement.x = 0; + _movement.y = -speed; // move down + } +} + +void Enemy21::enemy2(N5110 &lcd) +{ + + // Draws the first enemy for stage 2 + lcd.drawSprite(_a,_b,7,7,(int *)enemy21); + +} + +void Enemy21::update() +{ + _a += _movement.x; // updates the x position + _b += _movement.y; // updates the y position + +} + + +Vector2D Enemy21::get_movement() +{ + // gets the movement of the enemy + Vector2D m = {_movement.x,_movement.y}; + return m; +} + +void Enemy21::set_movement(Vector2D m) +{ + // sets the movement of the enemy + _movement.x = m.x; + _movement.y = m.y; +} + +void Enemy21::add_health() +{ + // increments the value of health by 1 + _health++; +} + +int Enemy21::get_health() +{ + // gets the value of health + return _health; +} + +Vector2D Enemy21::get_enemy21_pos() +{ + //gets the position of the first enemy of stage 2 + Vector2D e = {_a,_b}; + return e; +} + +void Enemy21::set_enemy21_pos(Vector2D e) +{ + //sets the position of the first enemy of stage 2 + _a = e.x; + _b = e.y; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy21.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,81 @@ +#ifndef ENEMY21_H +#define ENEMY21_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +/** Enemy21 Class + * @brief First enemy for stage two + * @author Rex Roshan Raj + */ + +class Enemy21 +{ + +public: + + /** Constructor */ + Enemy21(); + + /** Destructor */ + ~Enemy21(); + + /** Initialise the parameters for the first enemy in stage two + *@param a - x position of the enemy + *@param b - y position of the enemy + *@param speed - the speed of the enemy moving + */ + void init(int a,int b,int speed); + + /** Draws enemy + * @param N5110 lcd + * @brief Draws the first enemy in stage two + */ + void enemy2(N5110 &lcd); + + /** Updates the movement + * @brief Changes the movement of the enemy + */ + void update(); + + /** Adds the value of health by 1 */ + void add_health(); + + /** Sets the movement of the enemy + * @param movement + */ + void set_movement(Vector2D m); + + /** Sets the position of the enemy + * @param position of the enemy + */ + void set_enemy21_pos(Vector2D e); + + /** Gets the value of the health + * @returns value in range 0 to 10 + */ + int get_health(); + + /** Gets the position of the enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy21_pos(); + + /** Gets the movement of the enemy + * @returns a struct with x,y members which corresponds to x and y movement respectively + */ + Vector2D get_movement(); + +private: + + Vector2D _movement; + int _a; + int _b; + int _c; + int _speed; + int _health; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy22.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,101 @@ +#include "Enemy22.h" + +// nothing doing in the constructor and destructor +Enemy22::Enemy22() +{ + +} + +Enemy22::~Enemy22() +{ + +} + +// sprite of the second enemy for stage 2 +int enemy22 [7][7] ={ + +{1,1,0,0,0,0,0}, +{1,1,0,0,0,0,0}, +{0,0,1,0,0,0,0}, +{0,0,0,1,0,0,0}, +{0,0,0,0,1,0,0}, +{0,0,0,0,0,1,1}, +{0,0,0,0,0,1,1}, + +}; + +void Enemy22::init(int a,int b,int speed)// initialising the x and y position of the enemy and movement speed of the enemy +{ + + _a = a; // x position of the second enemy for stage 2 + _b = b; // y position of the second enemy for stage 2 + + _health = 0; // start health from zero + + int direction = rand() % 2; // randomise initial direction. + + // 4 possibilities. Get random modulo and set movement accordingly + if (direction == 0) { + _movement.x = 0; + _movement.y = speed; // moves up + } else { + _movement.x = 0; + _movement.y = -speed; // moves down + } +} + +void Enemy22::enemy2(N5110 &lcd) +{ + + // draws the second-two enemy + lcd.drawSprite(_a,_b,7,7,(int *)enemy22); + +} + +void Enemy22::update() +{ + _a += _movement.x; // updates the x position + _b += _movement.y; // updates the y position + +} + + +Vector2D Enemy22::get_movement() +{ + // gets the movement of the enemy + Vector2D m = {_movement.x,_movement.y}; + return m; +} + +void Enemy22::set_movement(Vector2D m) +{ + // sets the movement of the enemy + _movement.x = m.x; + _movement.y = m.y; +} + +void Enemy22::add_health() +{ + // increments the value of health by 1 + _health++; +} + +int Enemy22::get_health() +{ + // gets the value of health + return _health; +} + +Vector2D Enemy22::get_enemy22_pos() +{ + //gets the position of the second enemy for stage 2 + Vector2D e = {_a,_b}; + return e; +} + +void Enemy22::set_enemy22_pos(Vector2D e) +{ + //sets the position of the second enemy for stage 2 + _a = e.x; + _b = e.y; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/Enemy22.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,81 @@ +#ifndef ENEMY22_H +#define ENEMY22_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + + +/** Enemy22 Class + * @brief Second enemy for stage two + * @author Rex Roshan Raj + */ +class Enemy22 +{ + +public: + + /** Constructor */ + Enemy22(); + + /** Destructor */ + ~Enemy22(); + + /** Initialise the parameters for the second enemy in stage two + *@param a - x position of the enemy + *@param b - y position of the enemy + *@param speed - the speed of the enemy moving + */ + void init(int a,int b,int speed); + + /** Draws enemy + * @param N5110 lcd + * @brief Draws the second enemy in stage two + */ + void enemy2(N5110 &lcd); + + /** Updates the movement + * @brief Changes the movement of the enemy + */ + void update(); + + /** Adds the value of health by 1 */ + void add_health(); + + /** Sets the movement of the enemy + * @param movement + */ + void set_movement(Vector2D m); + + /** Sets the position of the enemy + * @param position of the enemy + */ + void set_enemy22_pos(Vector2D e); + + /** Gets the value of the health + * @returns value in range 0 to 10 + */ + int get_health(); + + /** Gets the position of the enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy22_pos(); + + /** Gets the movement of the enemy + * @returns a struct with x,y members which corresponds to x and y movement respectively + */ + Vector2D get_movement(); + +private: + + Vector2D _movement; + int _a; + int _b; + int _c; + int _speed; + int _health; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/EnemyBoss.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,209 @@ +#include "EnemyBoss.h" + +// nothing doing in the constructor and destructor +EnemyBoss::EnemyBoss() +{ + +} + +EnemyBoss::~EnemyBoss() +{ + +} + +// sprite of the third-(one&two) enemy +int enemy2 [7][8] = { + +{0,1,1,0,0,0,0,1}, +{0,0,0,1,1,1,1,1}, +{0,0,1,0,0,1,1,0}, +{0,1,0,0,1,1,1,0}, +{0,0,1,0,0,1,1,0}, +{0,0,0,1,1,1,1,1}, +{0,1,1,0,0,0,0,1}, + +}; + +// sprite of the third-boss enemy +int boss [13][13] = { + +{0,0,0,0,0,1,1,1,1,1,0,0,0}, +{0,0,0,0,0,0,1,1,1,0,0,0,0}, +{0,0,1,1,1,1,1,1,1,1,1,1,1}, +{0,0,0,0,0,1,0,1,0,0,1,0,0}, +{0,0,0,0,1,0,1,0,1,0,1,0,0}, +{0,0,0,1,0,0,0,1,0,1,1,0,0}, +{1,1,1,1,0,1,0,1,0,1,1,0,0}, +{0,0,0,1,0,0,0,1,0,1,1,0,0}, +{0,0,0,0,1,0,1,0,1,0,1,0,0}, +{0,0,0,0,0,1,0,1,0,0,1,0,0}, +{0,0,1,1,1,1,1,1,1,1,1,1,1}, +{0,0,0,0,0,0,1,1,1,0,0,0,0}, +{0,0,0,0,0,1,1,1,1,1,0,0,0}, + +}; + +void EnemyBoss::init(int a,int b,int c,int d,int e,int f,int speed) // initialising the x and y position of the third enemy and movement speed of the third enemy +{ + + _a = a; // x position of the boss enemy for stage 3 + _b = b; // y position of the boss enemy for stage 3 + _c = c; // x position of the first regular enemy for stage 3 + _d = d; // y position of the first regular enemy for stage 3 + _e = e; // x position of the second regular enemy for stage 3 + _f = f; // y position of the second regular enemy for stage 3 + + _health = 0; // start health from zero for boss + _health1 = 0; // start health from zero for first enemy + _health2 = 0; // start health from zero for second enemy + + _speed = speed; + +} + +Vector2D EnemyBoss::motion() +{ + int direction = rand() % 8; // randomise initial direction. + + // 8 possibilities. Get random modulo and set movement accordingly + if (direction == 0) { // North + _movement.x = 0; + _movement.y = -_speed; + } else if (direction == 1) { // North-East + _movement.x = _speed; + _movement.y = -_speed; + } else if (direction == 2) { // East + _movement.x = _speed; + _movement.y = 0; + } else if (direction == 3) { // South-East + _movement.x = _speed; + _movement.y = _speed; + } else if (direction == 4) { // South + _movement.x = 0; + _movement.y = _speed; + } else if (direction == 5) { // South-West + _movement.x = -_speed; + _movement.y = _speed; + } else if (direction == 6) { // West + _movement.x = -_speed; + _movement.y = 0; + }else { // North-West + _movement.x = -_speed; + _movement.y = -_speed; + } + Vector2D velocity = {_movement.x, _movement.y}; + return velocity; +} + +void EnemyBoss::enemyboss(N5110 &lcd) +{ + + // draws the boss enemy for stage 3 + lcd.drawSprite(_a,_b,13,13,(int *)boss); + // draws the first regular enemy for stage 3 + lcd.drawSprite(_c,_d,7,8,(int *)enemy2); + // draws the first regular enemy for stage 3 + lcd.drawSprite(_e,_f,7,8,(int *)enemy2); + +} + +void EnemyBoss::update() +{ + _a += _movement.x; // updates the x position for the boss enemy + _b += _movement.y; // updates the y position for the boss enemy + + // the first and second regular enemy stay stationery +} + + +Vector2D EnemyBoss::get_movement() +{ + // gets the movement of the boss enemy + Vector2D m = {_movement.x,_movement.y}; + return m; +} + +void EnemyBoss::set_movement(Vector2D m) +{ + // sets the movement of the boss enemy + _movement.x = m.x; + _movement.y = m.y; +} + +void EnemyBoss::add_health_boss() +{ + // increments the value of health by 1 for the boss enemy + _health++; +} + +int EnemyBoss::get_health_boss() +{ + // gets the value of boss health + return _health; +} + +void EnemyBoss::add_health_enemy1() +{ + // increments the value of health by 1 for the first regular enemy + _health1++; +} + +int EnemyBoss::get_health_enemy1() +{ + // gets the value of first regular enemy health + return _health1; +} + +void EnemyBoss::add_health_enemy2() +{ + // increments the value of health by 1 for the second regular enemy + _health2++; +} + +int EnemyBoss::get_health_enemy2() +{ + // gets the value of second regular enemy health + return _health2; +} + +Vector2D EnemyBoss::get_enemyboss_pos() +{ + //gets the position of the boss enemy for stage 3 + Vector2D e = {_a,_b}; + return e; +} + +Vector2D EnemyBoss::get_enemy1_pos() +{ + //gets the position of the first regular enemy for stage 3 + Vector2D d = {_c,_d}; + return d; +} + +Vector2D EnemyBoss::get_enemy2_pos() +{ + //gets the position of the second regular enemy for stage 3 + Vector2D c = {_e,_f}; + return c; +} + +void EnemyBoss::set_enemyboss_pos(Vector2D e) +{ + //sets the position of the boss enemy for stage 3 + _a = e.x; + _b = e.y; +} + +void EnemyBoss::set_enemy1_pos(Vector2D d) +{ + //sets the position of the first regular enemy for stage 3 + _c = d.x; + _d = d.y; +} + +void EnemyBoss::set_enemy2_pos(Vector2D c) +{ + //gets the position of the second regular enemy for stage 3 + _e = c.x; + _f = c.y; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy/EnemyBoss.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,147 @@ +#ifndef ENEMYBOSS_H +#define ENEMYBOSS_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Enemy.h" + +/** EnemyBoss Class + * @brief Enemies for stage three + * @author Rex Roshan Raj + */ +class EnemyBoss +{ + +public: + + /** Constructor */ + EnemyBoss(); + + /** Destructor */ + ~EnemyBoss(); + + /** Initialise the parameters for the enemies in stage three + *@param a - x position of the boss + *@param b - y position of the boss + *@param c - x position of the first enemy + *@param d - y position of the first enemy + *@param e - x position of the second enemy + *@param f - y position of the second enemy + *@param speed - the speed of the boss moving + */ + void init(int a,int b,int c,int d,int e,int f, int speed); + + /** Draws enemy + * @param N5110 lcd + * @brief Draws all three enemies in stage three + */ + void enemyboss(N5110 &lcd); + + /** Updates the movement + * @brief Changes the movement of the enemy + */ + void update(); + + /** Adds the value of health by 1 + *@brief Health for the boss + */ + void add_health_boss(); + + /** Adds the value of health by 1 + *@brief Health for the first enemy + */ + void add_health_enemy1(); + + /** Adds the value of health by 1 + *@brief Health for the second enemy + */ + void add_health_enemy2(); + + /** Gets the value of the health + * @brief returns the health of the boss + * @returns value in range 0 to 10 + */ + int get_health_boss(); + + /** Gets the value of the health + * @brief returns the health of the first enemy + * @returns value in range 0 to 10 + */ + int get_health_enemy1(); + + /** Gets the value of the health + * @brief returns the health of the second enemy + * @returns value in range 0 to 10 + */ + int get_health_enemy2(); + + /** Sets the movement of the enemy + * @param movement + */ + void set_movement(Vector2D m); + + /** Sets the position of the enemy + * @brief Position of the boss + * @param position + */ + void set_enemyboss_pos(Vector2D e); + + /** Sets the position of the enemy + * @brief Position of the first enemy + * @param position + */ + void set_enemy1_pos(Vector2D d); + + /** Sets the position of the enemy + * @brief Position of the second enemy + * @param position + */ + void set_enemy2_pos(Vector2D c); + + /** Gets the motion of the boss + * @returns a struct with x,y members which corresponds to velocity in the x and y direction respectively + */ + Vector2D motion(); + + /** Gets the position of the enemy + * @brief Position of the boss + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemyboss_pos(); + + /** Gets the position of the enemy + * @brief Position of the first enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy1_pos(); + + /** Gets the position of the enemy + * @brief Position of the second enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy2_pos(); + + /** Gets the movement of the boss + * @returns a struct with x,y members which corresponds to x and y movement respectively + */ + Vector2D get_movement(); + +private: + + Vector2D _movement; + int _a; + int _b; + int _c; + int _d; + int _e; + int _f; + int _direction; + int _speed; + int _health; + int _health1; + int _health2; + +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,48 @@ +#include "EnemyBeam.h" + +EnemyBeam::EnemyBeam() +{ + +} + +EnemyBeam::~EnemyBeam() +{ + +} + +void EnemyBeam::init(int size,int a, int b) // initialising beam for the enemy in the first stage +{ + _size = size; // size of the beam + _x = _size; // length of the beam + _y = 1; // height of the beam + _a = a; // x position of the enemy beam + _b = b + 4; // y position of the enemy beam +} + +void EnemyBeam::draw(N5110 &lcd) +{ + // draws the beam of the first stage enemy + lcd.drawRect(_a,_b,_x,_y,FILL_BLACK); +} + +void EnemyBeam::update() +{ + _speed = 5.0; // the speed of the beam moving is set at 5 + + _a-=_speed; // the beam moves in the negative x direction + +} + +Vector2D EnemyBeam::get_pos() +{ + // gets the position of the enemy beam + Vector2D b = {_a,_b}; + return b; +} + +void EnemyBeam::set_pos(Vector2D p) +{ + // sets the position of the enemy beam + _a = p.x ; + _b = p.y ; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,70 @@ +#ifndef ENEMYBEAM_H +#define ENEMYBEAM_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Enemy.h" + +// gap from edge of screen +#define GAP 2 + +/** EnemyBeam Class + * @brief Enemy beam in stage one + * @author Rex Roshan Raj + */ +class EnemyBeam +{ + +public: + + /** Constructor */ + EnemyBeam(); + + /** Destructor */ + ~EnemyBeam(); + + /** Initialise the parameters for the enemy's beam + *@param size - size of the beam + *@param a - x position of the enemy's beam + *@param b - y position of the enemy's beam + */ + void init(int size,int a, int b); + + /** Updates the beam + * @brief Changes the x position of the beam once it has been initialised + */ + void update(); + + /** Draws the enemy's beam + * @param N5110 lcd + */ + void draw(N5110 &lcd); + + /** Gets the position of the enemy's beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos(); + + /** Sets the position of the enemy's beam + * @brief Position of the enemy's beam + * @param position + */ + void set_pos(Vector2D p); + +private: + + + Enemy _e1; + + int _speed; + int _size; + + int _x; + int _y; + int _a; + int _b; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam2.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,69 @@ +#include "EnemyBeam2.h" + +EnemyBeam2::EnemyBeam2() +{ + +} + +EnemyBeam2::~EnemyBeam2() +{ + +} + +void EnemyBeam2::init(int size,int a, int b ,int c, int d) // initialising beam for the first and second enemy in the second stage +{ + _size = size; // size of the beam + _x = _size; // length of the beam + _y = _size; // height of the beam + _a = a; // x position of the first enemy beam + _b = b + 5; // y position of the first enemy beam + _c = c; // x position of the second enemy beam + _d = d; // y position of the second enemy beam +} + +void EnemyBeam2::draw(N5110 &lcd) +{ + // draws the first enemy beam of the second stage + lcd.drawRect(_a,_b,_x,_y,FILL_BLACK); + // draws the second enemy beam of the second stage + lcd.drawRect(_c,_d,_x,_y,FILL_BLACK); +} + +void EnemyBeam2::update() +{ + _speed = 5.0; // the speed of the beam moving is set at 5 + + _a-=_speed; // moves the first enemy beam in the negative x direction + _c-=_speed; // moves the second enemy beam in the negative x direction + + // the y direction is kept constant + +} + +Vector2D EnemyBeam2::get_pos_21() +{ + // gets the position of the first enemy beam + Vector2D b = {_a,_b}; + return b; +} + +Vector2D EnemyBeam2::get_pos_22() +{ + // gets the position of the second enemy beam + Vector2D c = {_c,_d}; + return c; +} + +void EnemyBeam2::set_pos_21(Vector2D p) +{ + // sets the position of the first enemy beam + _a = p.x ; + _b = p.y ; +} + +void EnemyBeam2::set_pos_22(Vector2D p) +{ + // sets the position of the second enemy beam + _c = p.x ; + _d = p.y ; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam2.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,90 @@ +#ifndef ENEMYBEAM2_H +#define ENEMYBEAM2_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Enemy21.h" +#include "Enemy22.h" + +// gap from edge of screen +#define GAP 2 + +/** EnemyBeam2 Class + * @brief Enemy beam in stage two + * @author Rex Roshan Raj + */ +class EnemyBeam2 +{ + +public: + + /** Constructor */ + EnemyBeam2(); + + /** Destructor */ + ~EnemyBeam2(); + + /** Initialise the parameters for the enemy's beam + *@param size - size of the beam + *@param a - x position of the first enemy's beam + *@param b - y position of the first enemy's beam + *@param c - x position of the second enemy's beam + *@param d - y position of the second enemy's beam + */ + void init(int size,int a, int b, int c, int d); + + /** Updates the beam + * @brief Changes the x position of the first and second enemy beam once it has been initialised + */ + void update(); + + /** Draws the enemy's beam + * @brief Draws both beams for first and second enemy + * @param N5110 lcd + */ + void draw(N5110 &lcd); + + /** Gets the position of the enemy's beam + * @brief Position of the first enemy beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_21(); + + /** Gets the position of the enemy's beam + * @brief Position of the second enemy beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_22(); + + /** Sets the position of the enemy's beam + * @brief Position of the first enemy's beam + * @param position + */ + void set_pos_21(Vector2D p); + + /** Sets the position of the enemy's beam + * @brief Position of the second enemy's beam + * @param position + */ + void set_pos_22(Vector2D p); + +private: + + + Enemy21 _e21; + Enemy22 _e22; + + int _speed; + int _size; + + int _x; + int _y; + int _a; + int _b; + int _c; + int _d; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam3.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,89 @@ +#include "EnemyBeam3.h" + +EnemyBeam3::EnemyBeam3() +{ + +} + +EnemyBeam3::~EnemyBeam3() +{ + +} + +void EnemyBeam3::init(int size,int a, int b ,int c, int d, int e, int f) // initialising beam for all the enemy in the third stage +{ + _size = size; // size of the beam + _x = _size; // length of the beam + _y = 1; // height of the beam + _a = a; // x position of the boss enemy beam + _b = b + 6; // y position of the boss enemy beam + _c = c; // x position of the first enemy beam + _d = d + 3; // y position of the first enemy beam + _e = e; // x position of the second enemy beam + _f = f + 3; // y position of the second enemy beam +} + +void EnemyBeam3::draw(N5110 &lcd) +{ + int random = rand()%4; + if(random < 2){ + // draws the beam of the enemy boss + lcd.drawRect(_a,_b,_x,_y,FILL_BLACK); + } + // draws the beam of the first regular enemy + lcd.drawRect(_c,_d,_x,_y,FILL_BLACK); + // draws the beam of the second regular enemy + lcd.drawRect(_e,_f,_x,_y,FILL_BLACK); +} + +void EnemyBeam3::update() +{ + _speed = 5.0; // the speed of the beam moving is set at 5 + + // moves the enemy beams in the negative x direction + _a-=_speed; + _c-=_speed; + _e-=_speed; + +} + +Vector2D EnemyBeam3::get_pos_boss() +{ + // gets the position of the enemy boss beam + Vector2D b = {_a,_b}; + return b; +} + +Vector2D EnemyBeam3::get_pos_enemy1() +{ + // gets the position of the first enemy beam + Vector2D c = {_c,_d}; + return c; +} + +Vector2D EnemyBeam3::get_pos_enemy2() +{ + // gets the position of the second enemy beam + Vector2D d = {_e,_f}; + return d; +} +void EnemyBeam3::set_pos_boss(Vector2D p) +{ + // sets the position of the enemy boss beam + _a = p.x ; + _b = p.y ; +} + +void EnemyBeam3::set_pos_enemy1(Vector2D p) +{ + // gets the position of the first enemy beam + _c = p.x ; + _d = p.y ; +} + +void EnemyBeam3::set_pos_enemy2(Vector2D p) +{ + // gets the position of the second enemy beam + _e = p.x ; + _f = p.y ; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyBeam/EnemyBeam3.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,105 @@ +#ifndef ENEMYBEAM3_H +#define ENEMYBEAM3_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Spacecraft.h" +#include "EnemyBoss.h" + +// gap from edge of screen +#define GAP 2 + +/** EnemyBeam3 Class + * @brief Enemy beam in stage three + * @author Rex Roshan Raj + */ +class EnemyBeam3 +{ + +public: + + /** Constructor */ + EnemyBeam3(); + + /** Destructor */ + ~EnemyBeam3(); + + /** Initialise the parameters for the enemy's beam in stage three + *@param size - size of the beam + *@param a - x position of the boss beam + *@param b - y position of the boss beam + *@param c - x position of the first enemy's beam + *@param d - y position of the first enemy's beam + *@param e - x position of the second enemy's beam + *@param f - y position of the second enemy's beam + */ + void init(int size,int a, int b, int c, int d,int e, int f); + + /** Updates the beam + * @brief Changes the x position of all the enemies beam once it has been initialised + */ + void update(); + + /** Draws the enemy's beam + * @brief Draws all three enemies + * @param N5110 lcd + */ + void draw(N5110 &lcd); + + /** Gets the position of the enemy's beam + * @brief Position of the boss beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_boss(); + + /** Gets the position of the enemy's beam + * @brief Position of the first enemy beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_enemy1(); + + /** Gets the position of the enemy's beam + * @brief Position of the second enemy beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos_enemy2(); + + /** Sets the position of the enemy's beam + * @brief Position of the boss beam + * @param position + */ + void set_pos_boss(Vector2D p); + + /** Sets the position of the enemy's beam + * @brief Position of the first enemy's beam + * @param position + */ + void set_pos_enemy1(Vector2D p); + + /** Sets the position of the enemy's beam + * @brief Position of the second enemy's beam + * @param position + */ + void set_pos_enemy2(Vector2D p); + +private: + + Spacecraft _p1; + EnemyBoss _e3; + + int _speed; + int _size; + + int _x; + int _y; + int _a; + int _b; + int _c; + int _d; + int _e; + int _f; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameEngine/GameEngine.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,964 @@ +#include "GameEngine.h" + +GameEngine::GameEngine() +{ + +} + +GameEngine::~GameEngine() +{ + +} + +// draws the background of the game +int backgrounds [48][84] = { + +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + +}; + +// draws alphabet r in morse code +int r [3][13] = { + +{0,1,0,0,0,0,0,0,0,0,0,1,0}, +{1,1,1,0,0,0,0,0,0,0,1,1,1}, +{0,1,0,0,1,1,1,1,1,0,0,1,0}, + +}; + +// draws alphabet e in morse code +int e [3][3] = { + +{0,1,0}, +{1,1,1}, +{0,1,0}, + +}; + +// draws alphabet x in morse code +int x [3][19] = { + +{0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0}, +{1,1,1,1,1,0,0,1,0,0,0,1,0,0,1,1,1,1,1}, + +}; + +// draws explosion +int explosion [23] [23] = { + +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0}, +{0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0}, +{0,0,0,0,0,1,1,1,1,1,0,0,1,1,0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int spacecraft_ypos,int enemy_xpos, int enemy_ypos,int enemy2_xpos, int enemy2_ypos,int enemy3_xpos, int enemy3_ypos,int beam_size,int beam2_size, int speed) +{ + // initialise the game parameters + _spacecraft_xpos = spacecraft_xpos; + _spacecraft_ypos = spacecraft_ypos; + + _enemy_xpos = enemy_xpos; + _enemy_ypos = enemy_ypos; + + _enemy2_xpos = enemy2_xpos; + _enemy2_ypos = enemy2_ypos; + + _enemy3_xpos = enemy3_xpos; + _enemy3_ypos = enemy3_ypos; + + + _beam_size = beam_size; // beam size for 1st and 3rd enemy + _beam2_size = beam2_size; // beam size for 2nd enemy + _speed = speed; // Speed of the enemy travelling + + + _p1x = GAP; + // x position on screen - WIDTH is defined in N5110.h + _e1a = WIDTH-_enemy_xpos; //enemy_xpos = 12 + // y position on screen - HEIGHT is defined in N5110.h + _e1b = HEIGHT/2-_enemy_ypos; //enemy_ypos = 4 + + _e2a = WIDTH-_enemy2_xpos; //enemy2_xpos = 12 + _e21b = HEIGHT/2 +_enemy2_ypos; //enemy2_ypos = 10 + _e22b = HEIGHT/2 -_enemy2_ypos; + + _e3a = WIDTH-_enemy3_xpos; //enemy3_xpos = 20 + _e3b = HEIGHT/2 -_enemy3_ypos; //enemy3_ypos = 7 + _e3c = WIDTH-_enemy3_xpos - 12; + _e3d = HEIGHT/2 + _enemy3_ypos;; + _e3f = HEIGHT/2 - _enemy3_ypos;; + + // Initialising the player's spacecraft and all enemy spacecrafts + _p1.init(_spacecraft_xpos,_spacecraft_ypos); + _e1.init(_e1a,_e1b); + _e21.init(_e2a,_e21b,_speed); + _e22.init(_e2a,_e22b,_speed); + _e3.init(_e3a,_e3b,_e3c,_e3d,_e3c,_e3f,_speed); + _e3.motion(); + + //_beam.init(_beam_size,p1_pos.x,p1_pos.y); + // Initialising the stage of the game + _stage = 0; + +} + +void GameEngine::read_input(Gamepad &pad) +{ + _d = pad.get_direction(); // Get the direction of the joystick + _mag = pad.get_mag(); // Get the magnitude value + _R = pad.check_event(Gamepad::R_PRESSED); // Check if the R button is being pressed + _L = pad.check_event(Gamepad::L_PRESSED); // Check if the L button is being pressed + +} + +void GameEngine::draw_mission_one(Gamepad &pad,N5110 &lcd) +{ + // draw the background of the game + lcd.drawSprite(0,0,48,84,(int *)backgrounds); + // draw the easter egg of the game + lcd.drawSprite(6,4,3,13,(int *)r); + //health + draw_enemy_health(lcd); + draw_spacecraft_health(pad); + // player spacecraft + _p1.character(lcd); + // first enemy + _e1.enemy(lcd); + // player spacecraft beam + _beam.draw(lcd); + // enemy spacecraft beam + _enemybeam.draw(lcd); + +} +void GameEngine::draw_mission_two(Gamepad &pad,N5110 &lcd) +{ + // draw the background of the game + lcd.drawSprite(0,0,48,84,(int *)backgrounds); + // draw the easter egg of the game + lcd.drawSprite(6,4,3,3,(int *)e); + //health + draw_spacecraft_health(pad); + draw_enemy21_health(lcd); + draw_enemy22_health(lcd); + // player spacecraft + _p1.character(lcd); + // second enemy + _e21.enemy2(lcd); + _e22.enemy2(lcd); + // player spacecraft beam + _beam.draw(lcd); + // second enemy spacecraft beam + _enemybeam2.draw(lcd); + +} + +void GameEngine::draw_mission_three(Gamepad &pad,N5110 &lcd) +{ + // draw the background of the game + lcd.drawSprite(0,0,48,84,(int *)backgrounds); + // draw the easter egg of the game + lcd.drawSprite(6,4,3,19,(int *)x); + //health + draw_spacecraft_health(pad); + draw_enemyboss_health(lcd); + // player spacecraft + _p1.character(lcd); + // third and final enemy + _e3.enemyboss(lcd); + // player spacecraft beam + _beam.draw(lcd); + // third enemy spacecraft beam + _enemybeam3.draw(lcd); + +} + +void GameEngine::update_mission_one(Gamepad &pad,N5110 &lcd) +{ + check_playerbeam_collision(pad); // Check if L/R is being pressed to initiate the player beam + check_enemybeam_collisions(pad); // Check if first enemy's beam has passed the wall to initiate a new beam + // updating spacecraft and enemy before checking collisions so that + // it displays the right value + _p1.update(_d,_mag); // Player spacecraft movement update + _beam.update(); // Player spacecraft's beam update + + // The enemy spacecraft is stationery in mission one + _enemybeam.update(); // Enemy spacecraft's beam update + + check_enemy_collisions(pad); // Check if the player spacecraft beam collides with the enemy spacecraft + check_spacecraft_collisions(pad); // Check if the enemy spacecraft beam collides with the player spacecraft + + // Animations and sound effect for the both the player's and enemy' spacecraft when they are dead + spacecraft_dead(lcd,pad); + enemy_dead(lcd,pad); + +} + +void GameEngine::update_mission_two(Gamepad &pad,N5110 &lcd) +{ + check_playerbeam_collision(pad); // Check if L/R is being pressed to initiate the player beam + check_enemybeam2_collisions(pad); // Check if first enemy's beam has passed the wall to initiate a new beam + // updating spacecraft and enemy before checking collisions so that + // it displays the right value + _p1.update(_d,_mag); // Player spacecraft movement update + _beam.update(); // Player spacecraft's beam update + + _enemybeam2.update(); // Enemy spacecraft's beam update + _e21.update(); // Second-one enemy spacecraft movement update + _e22.update(); // Second-two enemy spacecraft movement update + + check_enemy2_collisions(pad); // Check if the player spacecraft beam collides with the enemy spacecraft + check_spacecraft2_collisions(pad); // Check if the enemy spacecraft beam collides with the player spacecraft + check_wall_collisions(pad); // Check if enemy spacecraft hits the top and bottom wall to bounce off + + // Animations and sound effect for the both the player's and enemy' spacecraft when they are dead + spacecraft2_dead(lcd,pad); + enemy2_dead(lcd,pad); + +} + +void GameEngine::update_mission_three(Gamepad &pad,N5110 &lcd) +{ + check_playerbeam_collision(pad); + check_enemybeam3_collisions(pad); + + _p1.update(_d,_mag); // Player spacecraft movement update + _beam.update(); // Player spacecraft beam update + _enemybeam3.update(); // Third enemy's spacecraft's beam update + //_e3.motion(); + _e3.update(); // Third enemy spacecraft movement update + check_enemy3_collisions(pad); // Check if the player spacecraft beam collides with the third enemy spacecraft + check_spacecraft3_collisions(pad); // Check if the third enemy spacecraft beam collides with the player spacecraft + check_wall2_collisions(pad); // Check if enemy spacecraft hits the top,bottom, wall to bounce off + // Animations and sound effect for the both the player's and enemy' spacecraft + spacecraft3_dead(lcd,pad); + enemy3_dead(lcd,pad); + +} +void GameEngine::check_enemy_collisions(Gamepad &pad) +{ + // read current enemy spacecraft's and player spacecraft's beam attributes + Vector2D beam_pos = _beam.get_pos(); + Vector2D e1_pos = _e1.get_enemy_pos(); + + // see if player's spacecraft beam has hit the enemy's spacecraft by checking for overlaps + if ( + (beam_pos.y >= e1_pos.y) && //top + (beam_pos.y <= e1_pos.y + 7) && //bottom + (beam_pos.x + _beam_size >= _e1a) && //left + (beam_pos.x + _beam_size <= _e1a + 8) //right + ) { + // add first enemy health + _e1.add_health(); + spacebeam = true; + _e1.location(); + // audio feedback + pad.tone(1000.0,0.1); + } + + // write new attributes + _beam.set_pos(beam_pos); +} + +void GameEngine::check_enemy2_collisions(Gamepad &pad) +{ + // read curent player spacecraft's beam attributes + Vector2D beam_pos = _beam.get_pos(); + // check e21 first + Vector2D e21_pos = _e21.get_enemy21_pos(); + + // see if player's spacecraft beam has hit the enemy's spacecraft by checking for overlaps + if ( + (beam_pos.y >= e21_pos.y) && //top + (beam_pos.y <= e21_pos.y + 7) && //bottom + (beam_pos.x + _beam_size >= _e2a) && //left + (beam_pos.x + _beam_size <= _e2a + 7) //right + ) { + // add health to first second level enemy + _e21.add_health(); + // set boolean spacebeam true + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + // check e22 next + Vector2D e22_pos = _e22.get_enemy22_pos(); + + if ( + (beam_pos.y >= e22_pos.y) && //top + (beam_pos.y <= e22_pos.y + 7) && //bottom + (beam_pos.x + _beam_size >= _e2a) && //left + (beam_pos.x + _beam_size <= _e2a + 7) //right + ) { + // add health to second, second level enemy + _e22.add_health(); + // set boolean spacebeam true + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + + // write new attributes + _beam.set_pos(beam_pos); +} + +void GameEngine::check_enemy3_collisions(Gamepad &pad) +{ + // read curent player's spacecraft beam attributes + Vector2D beam_pos = _beam.get_pos(); + + // check e3boss first + Vector2D e3boss_pos = _e3.get_enemyboss_pos(); + + // see if player's spacecraft beam has hit the enemy's spacecraft by checking for overlaps + if ( + (beam_pos.y >= e3boss_pos.y) && //top + (beam_pos.y <= e3boss_pos.y + 12) && //bottom + (beam_pos.x + _beam_size >= _e3a) && //left + (beam_pos.x + _beam_size <= _e3a + 12) //right + ) { + // add health to enemy boss + _e3.add_health_boss(); + // set boolean spacebeam true + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + // check e3enemy1 next + Vector2D e3enemy1_pos = _e3.get_enemy1_pos(); + + if ( + (beam_pos.y >= e3enemy1_pos.y) && //top + (beam_pos.y <= e3enemy1_pos.y + 6) && //bottom + (beam_pos.x + _beam_size >= _e3c) && //left + (beam_pos.x + _beam_size <= _e3c + 7) //right + ) { + // add health to first third level enemy + _e3.add_health_enemy1(); + // set boolean spacebeam true + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + // check e3enemy2 next + Vector2D e3enemy2_pos = _e3.get_enemy2_pos(); + + if ( + (beam_pos.y >= e3enemy2_pos.y) && //top + (beam_pos.y <= e3enemy2_pos.y + 6) && //bottom + (beam_pos.x + _beam_size >= _e3c) && //left + (beam_pos.x + _beam_size <= _e3c + 7) //right + ) { + // add health to second third level enemy + _e3.add_health_enemy2(); + // set boolean spacebeam true + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + // write new attributes + _beam.set_pos(beam_pos); +} + +void GameEngine::check_playerbeam_collision(Gamepad &pad) // check if player's spacecraft beam has collided with the edges of screen or enemy +{ + Vector2D p1_pos = _p1.get_pos(); // Get player's spacecraft position + Vector2D beam_pos = _beam.get_pos(); // Get player's spacecraft beam position + + if((_R == true)|| (_L == true)){ + if ((beam_pos.x + _beam_size > WIDTH) || (spacebeam == true)){ // if hits the enemy or the wall + _beam.init(_beam_size,p1_pos.x,p1_pos.y); + _R = false; // Then set the boolean _R and _L to false + _L = false; + } +} +} + +void GameEngine::check_enemybeam_collisions(Gamepad &pad) // check if enemy beam has collided with the edges of screen or spacecraft in stage one +{ + Vector2D enemy_pos = _e1.get_enemy_pos(); // Position of the first enemy + Vector2D enemybeam_pos = _enemybeam.get_pos(); // Get first enemy's beam position + + if ((_ebeam == true)||(enemybeam_pos.x - _beam_size < 0)) { // if hits the speacecraft or the wall + _enemybeam.init(_beam_size,enemy_pos.x,enemy_pos.y); // Initialise the enemy beam in stage one + _ebeam = false; // Then set the boolean _ebeam to false + } +} + +void GameEngine::check_enemybeam2_collisions(Gamepad &pad) // check if enemy beam has collided with the edges of screen or spacecraft in stage two +{ + Vector2D enemy21_pos = _e21.get_enemy21_pos(); // Get first enemy's position in stage two + Vector2D enemy22_pos = _e22.get_enemy22_pos(); // Get second enemy's position in stage two + Vector2D enemybeam21_pos = _enemybeam2.get_pos_21(); // Get first enemy's beam position in stage two + Vector2D enemybeam22_pos = _enemybeam2.get_pos_22(); // Get second enemy's beam position in stage two + + if ((_ebeam21 == true)||(_ebeam22 == true)||(enemybeam21_pos.x - _beam2_size < 0)||(enemybeam22_pos.x - _beam2_size < 0)) { // if hits the speacecraft or the wall + _enemybeam2.init(_beam2_size,enemy21_pos.x,enemy21_pos.y,enemy22_pos.x,enemy22_pos.y); // Initialise the enemy beam in stage two + _ebeam21 = false; // Then set the boolean _ebeam21 and _ebeam22 to false + _ebeam22 = false; + } +} + +void GameEngine::check_enemybeam3_collisions(Gamepad &pad) // check if enemy beam has collided with the edges of screen or spacecraft in stage three +{ + Vector2D enemyboss_pos = _e3.get_enemyboss_pos(); // Get boss enemy's position in stage three + Vector2D enemy1_pos = _e3.get_enemy1_pos(); // Get first regular enemy's position in stage three + Vector2D enemy2_pos = _e3.get_enemy2_pos(); // Get second regular enemy's position in stage three + + Vector2D enemybossbeam3_pos = _enemybeam3.get_pos_boss(); // Get boss enemy's beam position in stage three + Vector2D enemy1beam3_pos = _enemybeam3.get_pos_enemy1(); // Get first regular enemy's beam position in stage three + Vector2D enemy2beam3_pos = _enemybeam3.get_pos_enemy2(); // Get second regular enemy's beam position in stage three + + if ((_ebeam3boss == true)||(_ebeam31 == true)||(_ebeam32 == true)||(enemybossbeam3_pos.x - _beam_size < 0)||(enemy1beam3_pos.x - _beam_size < 0)||(enemy2beam3_pos.x - _beam_size < 0)) { // if hits the speacecraft or the wall + _enemybeam3.init(_beam_size,enemyboss_pos.x,enemyboss_pos.y,enemy1_pos.x,enemy1_pos.y,enemy2_pos.x,enemy2_pos.y); // Initialise the enemy beam in stage three + _ebeam3boss = false; // Then set boolean _ebeam3boss,_ebeam31, _ebeam32 to false + _ebeam31 = false; + _ebeam32 = false; + } +} + +void GameEngine::check_spacecraft_collisions(Gamepad &pad) // check spacecraft collision with enemy beam in stage one +{ + Vector2D enemybeam_pos = _enemybeam.get_pos(); // Gets the position of the enemy's beam in stage one + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + // see if beam has hit the enemy by checking for overlaps + if ( + (enemybeam_pos.y >= p1_pos.y) && //top + (enemybeam_pos.y <= p1_pos.y + 11) && //bottom + (enemybeam_pos.x >= _p1x) && //left + (enemybeam_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); // outputs sound if it hits the player's spacecraft + } + // write new attributes + _enemybeam.set_pos(enemybeam_pos); + +} + +void GameEngine::check_spacecraft2_collisions(Gamepad &pad) // check spacecraft collision with enemy beam in stage two +{ + Vector2D enemybeam21_pos = _enemybeam2.get_pos_21(); // Gets the position of the first enemy's beam in stage two + Vector2D enemybeam22_pos = _enemybeam2.get_pos_22(); // Gets the position of the second enemy's beam in stage two + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + // see if beam has hit the enemy by checking for overlaps + if ( + (enemybeam21_pos.y >= p1_pos.y) && //top + (enemybeam21_pos.y <= p1_pos.y + 11) && //bottom + (enemybeam21_pos.x >= _p1x) && //left + (enemybeam21_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam21 = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); // outputs sound if it hits the player's spacecraft + } + else if ( + (enemybeam22_pos.y >= p1_pos.y) && //top + (enemybeam22_pos.y <= p1_pos.y + 11) && //bottom + (enemybeam22_pos.x >= _p1x) && //left + (enemybeam22_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam22 = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); // outputs sound if it hits the player's spacecraft + } + // write new attributes + _enemybeam2.set_pos_21(enemybeam21_pos); + _enemybeam2.set_pos_22(enemybeam22_pos); + +} + +void GameEngine::check_spacecraft3_collisions(Gamepad &pad) // check spacecraft collision with enemy beam in stage three +{ + Vector2D enemybossbeam_pos = _enemybeam3.get_pos_boss(); // Gets the position of the boss enemy's beam in stage three + Vector2D enemy1beam_pos = _enemybeam3.get_pos_enemy1(); // Gets the position of the first enemy's beam in stage three + Vector2D enemy2beam_pos = _enemybeam3.get_pos_enemy2(); // Gets the position of the second enemy's beam in stage three + + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + // see if beam has hit the enemy by checking for overlaps + if ( + (enemybossbeam_pos.y >= p1_pos.y) && //top + (enemybossbeam_pos.y <= p1_pos.y + 11) && //bottom + (enemybossbeam_pos.x >= _p1x) && //left + (enemybossbeam_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam3boss = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); + } + else if ( + (enemy1beam_pos.y >= p1_pos.y) && //top + (enemy1beam_pos.y <= p1_pos.y + 11) && //bottom + (enemy1beam_pos.x >= _p1x) && //left + (enemy1beam_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam31 = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); + } + else if ( + (enemy2beam_pos.y >= p1_pos.y) && //top + (enemy2beam_pos.y <= p1_pos.y + 11) && //bottom + (enemy2beam_pos.x >= _p1x) && //left + (enemy2beam_pos.x <= _p1x + 11) //right + ) { + _p1.add_health(); // adds health + _ebeam32 = true; // sets boolean to true to initialise beam + pad.tone(87.3,0.1); // outputs sound if it hits the player's spacecraft + } + // write new attributes + _enemybeam3.set_pos_boss(enemybossbeam_pos); + _enemybeam3.set_pos_enemy1(enemy1beam_pos); + _enemybeam3.set_pos_enemy2(enemy2beam_pos); + +} +void GameEngine::check_wall_collision(Gamepad &pad) // check wall collision for enemy in stage one +{ + // read current enemy attributes for boss in stage three + Vector2D enemy_pos = _e1.get_enemy_pos(); + + // check if hit top wall + if (enemy_pos.y <= 1) { // 1 due to 1 pixel boundary + enemy_pos.y = 1; // bounce off ceiling without going off screen + } + // check if hit bottom wall + else if (enemy_pos.y + 12 >= (HEIGHT-1) ) { // bottom pixel is 47 + enemy_pos.y = (HEIGHT-1) - 12; // stops ball going off screen + // check if hit right wall + }else if (enemy_pos.x + 12 >= (WIDTH-1) ) { // right pixel is 83 + enemy_pos.x = (WIDTH-1) - 12; // stops ball going off screen + // check if left right wall + }else if (enemy_pos.x <= WIDTH/2) { // half the width (42) + enemy_pos.x = WIDTH/2; // bounce off ceiling without going halfway + } + _e1.set_enemy_pos(enemy_pos); + +} + +void GameEngine::check_wall_collisions(Gamepad &pad) // check wall collision for enemies in stage two +{ + // read current attributes of the enemies + Vector2D enemy21_pos = _e21.get_enemy21_pos(); + Vector2D enemy22_pos = _e22.get_enemy22_pos(); + Vector2D enemy21_movement = _e21.get_movement(); + Vector2D enemy22_movement = _e22.get_movement(); + + // check if hit top wall + // first enemy + if (enemy21_pos.y <= 1) { // 1 due to 1 pixel boundary + enemy21_pos.y = 1; // bounce off ceiling without going off screen + enemy21_movement.y = -enemy21_movement.y; + } + //second enemy + else if (enemy22_pos.y <= 1) { + enemy22_pos.y = 1; + enemy22_movement.y = -enemy22_movement.y; + } + // check if hit bottom wall + // first enemy + else if (enemy21_pos.y + 7 >= (HEIGHT-1) ) { // bottom pixel is 47 + enemy21_pos.y = (HEIGHT-1) - 7; // stops ball going off screen + enemy21_movement.y = -enemy21_movement.y; + // second enemy + } else if (enemy22_pos.y + 7 >= (HEIGHT-1) ) { + enemy22_pos.y = (HEIGHT-1) - 7; + enemy22_movement.y = -enemy22_movement.y; + + } + + // update first and second enemy parameters + _e21.set_movement(enemy21_movement); + _e22.set_movement(enemy22_movement); + _e21.set_enemy21_pos(enemy21_pos); + _e22.set_enemy22_pos(enemy22_pos); +} + +void GameEngine::check_wall2_collisions(Gamepad &pad) // check wall collision for enemies in stage three +{ + // read current enemy attributes for boss in stage three + Vector2D enemyboss_pos = _e3.get_enemyboss_pos(); + Vector2D enemyboss_movement = _e3.get_movement(); + + // check if hit top wall + if (enemyboss_pos.y <= 1) { // 1 due to 1 pixel boundary + enemyboss_pos.y = 1; // bounce off ceiling without going off screen + enemyboss_movement = _e3.motion(); + } + // check if hit bottom wall + else if (enemyboss_pos.y + 12 >= (HEIGHT-1) ) { // bottom pixel is 47 + enemyboss_pos.y = (HEIGHT-1) - 12; // stops ball going off screen + enemyboss_movement = _e3.motion(); + // check if hit right wall + }else if (enemyboss_pos.x + 12 >= (WIDTH-1) ) { // right pixel is 83 + enemyboss_pos.x = (WIDTH-1) - 12; // stops ball going off screen + enemyboss_movement = _e3.motion(); + // check if left right wall + }else if (enemyboss_pos.x <= WIDTH/2) { // half the width (42) + enemyboss_pos.x = WIDTH/2; // bounce off ceiling without going halfway + enemyboss_movement = _e3.motion(); + } + // update boss enemy parameters + _e3.set_movement(enemyboss_movement); + _e3.set_enemyboss_pos(enemyboss_pos); + +} + +void GameEngine::enemy_dead(N5110 &lcd, Gamepad &pad){ // animation when the enemy is dead in stage one + + int e1_health = _e1.get_health(); // Gets the health of the enemy + Vector2D e1_pos = _e1.get_enemy_pos(); // Gets the position of the enemy + + if (e1_health == 10){ + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(e1_pos.x-10,e1_pos.y-10,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.5); + _e1.update(); + lcd.drawSprite(e1_pos.x-10,e1_pos.y-10,23,23,(int *)explosion); + _stage = 2; // mission one pass + lcd.refresh(); + } + +} + +void GameEngine::enemy2_dead(N5110 &lcd, Gamepad &pad){ // animation when the enemy is dead in stage two + + int e21_health = _e21.get_health(); // Gets the health of the first enemy + int e22_health = _e22.get_health(); // Gets the health of the second enemy + + Vector2D e21_pos = _e21.get_enemy21_pos(); // Gets the position of the first enemy + Vector2D e22_pos = _e22.get_enemy22_pos(); // Gets the position of the second enemy + + if ((e21_health >= 10) && (e22_health >= 10)){ + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(e21_pos.x-10,e21_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e22_pos.x-10,e22_pos.y-10,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.2); + lcd.drawSprite(e21_pos.x-10,e21_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e22_pos.x-10,e22_pos.y-10,23,23,(int *)explosion); + _stage = 4; // mission two pass + lcd.refresh(); + } + +} + +void GameEngine::enemy3_dead(N5110 &lcd, Gamepad &pad){ // animation when the enemy is dead in stage three + + int e3boss_health = _e3.get_health_boss(); // Gets the health of the boss enemy + int e31_health = _e3.get_health_enemy1(); // Gets the health of the first enemy + int e32_health = _e3.get_health_enemy2(); // Gets the health of the second enemy + + Vector2D e3boss_pos = _e3.get_enemyboss_pos(); // Gets the position of the boss enemy + Vector2D e31_pos = _e3.get_enemy1_pos(); // Gets the position of the first enemy + Vector2D e32_pos = _e3.get_enemy2_pos(); // Gets the position of the second enemy + + // explodes and outputs sound if the enemy is dead + if ((e3boss_health >= 10) && (e31_health >= 10) && (e32_health >= 10)){ + lcd.drawSprite(e3boss_pos.x-10,e3boss_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e31_pos.x-10,e31_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e32_pos.x-10,e32_pos.y-10,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.2); + lcd.drawSprite(e3boss_pos.x-10,e3boss_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e31_pos.x-10,e31_pos.y-10,23,23,(int *)explosion); + lcd.drawSprite(e32_pos.x-10,e32_pos.y-10,23,23,(int *)explosion); + _stage = 6; // mission three pass + lcd.refresh(); + } + +} + +void GameEngine::spacecraft_dead(N5110 &lcd, Gamepad &pad) // animation when the player's spacecraft is dead in stage one +{ + int p1_health = _p1.get_health(); // Gets the health of the player spacecraft + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + if (p1_health == 6){ + + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.5); + lcd.refresh(); + wait(0.1); + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + _p1.update_move(); + _stage = 1; // mission one fail + lcd.refresh(); + } + +} + +void GameEngine::spacecraft2_dead(N5110 &lcd, Gamepad &pad) // animation when the player's spacecraft is dead in stage two +{ + + int p1_health = _p1.get_health(); // Gets the health of the player spacecraft + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + if (p1_health == 6){ + + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.5); + lcd.refresh(); + wait(0.1); + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + _p1.update_move(); + _stage = 3; // mission two fail + lcd.refresh(); + } + +} + +void GameEngine::spacecraft3_dead(N5110 &lcd, Gamepad &pad) // animation when the player's spacecraft is dead in stage three +{ + int p1_health = _p1.get_health(); // Gets the health of the player spacecraft + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + if (p1_health == 6){ + + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.5); + lcd.refresh(); + wait(0.1); + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosion); + _p1.update_move(); + _stage = 5; // mission three fail + lcd.refresh(); + } + +} + +void GameEngine::draw_enemy_health(N5110 &lcd) +{ + // get health of the enemy + int e1_health = _e1.get_health(); + + if (e1_health <= 10){ + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + lcd.drawRect(62,42,20-2*e1_health,4,FILL_BLACK); + } + else { + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + } + + +} + +void GameEngine::draw_enemy21_health(N5110 &lcd) +{ + // get health of the enemy + int e21_health = _e21.get_health(); + + if (e21_health <= 10){ + lcd.drawRect(2,42,20,4,FILL_TRANSPARENT); + lcd.drawRect(2,42,20-2*e21_health,4,FILL_BLACK); + } + else { + lcd.drawRect(2,42,20,4,FILL_TRANSPARENT); + } +} + +void GameEngine::draw_enemy22_health(N5110 &lcd) +{ + // get health of the enemy + int e22_health = _e22.get_health(); + + if (e22_health <= 10){ + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + lcd.drawRect(62,42,20-2*e22_health,4,FILL_BLACK); + } + else { + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + } + +} + +void GameEngine::draw_enemyboss_health(N5110 &lcd) +{ + // get health of the enemy in stage three + int e3boss_health = _e3.get_health_boss(); + int e3enemy1_health = _e3.get_health_enemy1(); + int e3enemy2_health = _e3.get_health_enemy2(); + + if (e3boss_health <= 10){ + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + lcd.drawRect(62,42,20-2*e3boss_health,4,FILL_BLACK); + } + else { + lcd.drawRect(62,42,20,4,FILL_TRANSPARENT); + } + if (e3enemy1_health <= 10){ + lcd.drawRect(2,42,20,4,FILL_TRANSPARENT); + lcd.drawRect(2,42,20-2*e3enemy1_health,4,FILL_BLACK); + } + else { + lcd.drawRect(2,42,20,4,FILL_TRANSPARENT); + } + if (e3enemy2_health <= 10){ + lcd.drawRect(62,2,20,4,FILL_TRANSPARENT); + lcd.drawRect(62,2,20-2*e3enemy2_health,4,FILL_BLACK); + } + else { + lcd.drawRect(62,2,20,4,FILL_TRANSPARENT); + } +} + +void GameEngine::draw_spacecraft_health(Gamepad &pad) +{ + //get the health of the spacecraft + int p1_health = _p1.get_health(); + + if (p1_health == 0){ // All the lights are switched on + pad.leds_on(); + + }else if (p1_health == 1){ // Switches off the left most light + pad.led(1,0); + pad.led(2,1); + pad.led(3,1); + pad.led(4,1); + pad.led(5,1); + pad.led(6,1); + + }else if (p1_health == 2){ // Switches of the two left most lights + pad.led(1,0); + pad.led(2,0); + pad.led(3,1); + pad.led(4,1); + pad.led(5,1); + pad.led(6,1); + }else if (p1_health == 3){ // Swtiches of the three left most lights + pad.led(1,0); + pad.led(2,0); + pad.led(3,0); + pad.led(4,1); + pad.led(5,1); + pad.led(6,1); + + }else if (p1_health == 4){ // Switches off the four left most lights + pad.led(1,0); + pad.led(2,0); + pad.led(3,0); + pad.led(4,0); + pad.led(5,1); + pad.led(6,1); + + }else if (p1_health == 5){ // Switches the five left most light + pad.led(1,0); + pad.led(2,0); + pad.led(3,0); + pad.led(4,0); + pad.led(5,0); + pad.led(6,1); + + } else { + pad.leds_off(); // Switches all the Led light off + } + +} + +int GameEngine::get_game_stage() { + int stage = _stage; + return stage; // Gets the value of the stage +} + +int GameEngine::restart_game_stage() { + + int stage = _stage; + stage = 0; // sets the stage to be zero + return stage; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameEngine/GameEngine.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,195 @@ +#ifndef GAMEENGINE_H +#define GAMEENGINE_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Enemy.h" +#include "Enemy21.h" +#include "Enemy22.h" +#include "EnemyBoss.h" +#include "EnemyBeam.h" +#include "EnemyBeam2.h" +#include "EnemyBeam3.h" +#include "Beam.h" +#include "Spacecraft.h" + +// gap from edge of screen +#define GAP 2 + +/** GameEngine Class + * @brief The game engine for the game + * @author Rex Roshan Raj + */ +class GameEngine +{ + +public: + + /** Constructor */ + GameEngine(); + + /** Destructor */ + ~GameEngine(); + + /** Initialise the parameters for the game engine + *@param size - size of the beam + *@param spacecraft_xpos - x position of the player's spacecraft + *@param spacecraft_ypos - y position of the player's spacecraft + *@param enemy_xpos - x position of the enemy in stage one + *@param enemy_ypos - y position of the enemy in stage one + *@param enemy2_xpos - x position of the enemy in stage two + *@param enemy2_ypos - y position of the enemy in stage two + *@param enemy3_xpos - x position of the boss in stage three + *@param enemy3_ypos - y position of the boss in stage three + *@param beam_size - size of the beam in stage one and three + *@param beam2_size - size of the beam in stage two + *@param speed - speed of the objects moving + */ + void init(int spacecraft_xpos,int spacecraft_ypos,int enemy_xpos, int enemy_ypos,int enemy2_xpos, int enemy2_ypos,int enemy3_xpos, int enemy3_ypos, int beam_size, int beam2_size, int speed); + + /** Read the input + * @param Gamepad pad + * @brief Reads the input from the Gamepad + */ + void read_input(Gamepad &pad); + + /** Updates mission one + * @param Gamepad pad + * @param N5110 lcd + */ + void update_mission_one(Gamepad &pad,N5110 &lcd); + + + /** Updates mission two + * @param Gamepad pad + * @param N5110 lcd + */ + void update_mission_two(Gamepad &pad,N5110 &lcd); + + + /** Updates mission three + * @param Gamepad pad + * @param N5110 lcd + */ + void update_mission_three(Gamepad &pad,N5110 &lcd); + + /** Draws objects in mission one + * @param N5110 lcd + * @brief Draws the characters and the beams involved in mission one + */ + void draw_mission_one(Gamepad &pad,N5110 &lcd); + + /** Draws objects in mission two + * @param N5110 lcd + * @brief Draws the characters and the beams involved in mission two + */ + void draw_mission_two(Gamepad &pad,N5110 &lcd); + + /** Draws objects in mission three + * @param N5110 lcd + * @brief Draws the characters and the beams involved in mission three + */ + void draw_mission_three(Gamepad &pad,N5110 &lcd); + + /** Gets the stage of the game + * @returns a value from 1 to 6 + */ + int get_game_stage(); + + /** Sets the stage of the game + * @brief Sets the stage of the game to be zero + * @returns a value of 0 + */ + int restart_game_stage(); + + +private: + + void check_enemy_collisions(Gamepad &pad); // check if the player spacecraft beam collided with the enemy in mission one + void check_enemy2_collisions(Gamepad &pad); // check if the player spacecraft beam collided with the enemy in mission two + void check_enemy3_collisions(Gamepad &pad); // check if the player spacecraft beam collided with the enemy in mission three + + void check_wall_collision(Gamepad &pad); // check if the enemy in mission one has collided with the wall + void check_wall_collisions(Gamepad &pad); // check if the enemy in mission two has collided with the wall + void check_wall2_collisions(Gamepad &pad); // check if the enemy in mission three has collided with the wall + + void enemy_dead(N5110 &lcd,Gamepad &pad); // check if enemy spacecraft is dead + void enemy2_dead(N5110 &lcd,Gamepad &pad); // check if enemy spacecraft is dead + void enemy3_dead(N5110 &lcd,Gamepad &pad); // check if enemy spacecraft is dead + + void spacecraft_dead(N5110 &lcd,Gamepad &pad); // check if the player spacecraft is dead + void spacecraft2_dead(N5110 &lcd,Gamepad &pad); // check if the player spacecraft is dead + void spacecraft3_dead(N5110 &lcd,Gamepad &pad); // check if the player spacecraft is dead + + void check_spacecraft_collisions(Gamepad &pad); // check if the enemy spacecraft beam collided with the player spacecraft + void check_spacecraft2_collisions(Gamepad &pad); // check if the enemy spacecraft beam collided with the player spacecraft + void check_spacecraft3_collisions(Gamepad &pad); // check if the enemy spacecraft beam collided with the player spacecraft + + void check_enemybeam_collisions(Gamepad &pad); // check if the enemy beam in mission one collided with the wall + void check_enemybeam2_collisions(Gamepad &pad); // check if the enemy beam in mission two collided with the wall + void check_enemybeam3_collisions(Gamepad &pad); // check if the enemy beam in mission three collided with the wall + + void check_playerbeam_collision(Gamepad &pad); // check if the player's spacecraft beam collided with the wall + + void draw_enemy_health(N5110 &lcd); // draw the enemy health in mission one + void draw_enemy21_health(N5110 &lcd); // draw the first enemy health in mission two + void draw_enemy22_health(N5110 &lcd); // draw the second enemy health in mission two + void draw_enemyboss_health(N5110 &lcd); // draw the enemy health in mission three + void draw_spacecraft_health(Gamepad &pad); // draw the player's spacecraft health + + Spacecraft _p1; //player spacecraft + Enemy _e1; // first enemy spacecraft + Enemy21 _e21; // second enemy spacecraft + Enemy22 _e22; // second enemy spacecraft + EnemyBoss _e3; + + int _spacecraft_xpos; // x position of the spacecrafts + int _spacecraft_ypos; // y position of the spacecrafts + + int _enemy_xpos; // x position of the enemy from the WIDTH + int _enemy_ypos; // y position of the enemy from the HEIGHT + int _e1a; // x position of the enemy + int _e1b; // y position of the enemy + int _p1x; + + int _enemy2_xpos; // x position of the second enemy from the WIDTH + int _enemy2_ypos; // y position of the second enemy from the HEIGHT + int _e2a; // x position of the second enemy + int _e21b; // y position of the second enemy + int _e22b; + + int _enemy3_xpos; // x position of the boss enemy from the WIDTH + int _enemy3_ypos; // y position of the boss enemy from the HEIGHT + int _e3a; + int _e3b; + int _e3c; + int _e3d; + int _e3f; + + int _speed; // the beginning speed + int _beam_size; // beam size in mission one and three + int _beam2_size; // beam size in mission two + + Beam _beam; + EnemyBeam _enemybeam; + EnemyBeam2 _enemybeam2; + EnemyBeam3 _enemybeam3; + + Direction _d; + float _mag; + + bool _L; + bool _R; + bool spacebeam; + bool _ebeam; + bool _ebeam21; + bool _ebeam22; + bool _ebeam3boss; + bool _ebeam31; + bool _ebeam32; + int _stage; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gamepad.lib Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/RexRoshan/code/Gamepad/#90a92f7ca6c7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Instruction/Instruction.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,937 @@ +#include "Instruction.h" + +Instruction::Instru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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0}, + +}; + +// sprite of the game rules top border +int game_top [1][82] = { + +{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} + +}; + +// sprite of the game rules side border +int game_side [48][1] = { + +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, + +}; + +// sprite of the instruction page side border +int instruction_side [37][1] = { + +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, +{1}, + +}; + +// sprite of rule one +int rule_one [13] [75] = { + +{0,0,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0}, +{0,1,1,0,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ule4 }; +enum States { Life0,Life1,Life2,Life3,Life4,Life5,Life6,Life7,Life8,Life9,Life10,Life11,Life12 }; // enum state for instruction and game page + +void Instruction::rules(N5110 &lcd,Gamepad &pad){ + +int fps = 5; // set the frames per second to 5 +States currentInstruction = Life0; // current instruction is Life 1 + + while(currentInstruction != Life12) { + switch(currentInstruction){ + case Life0: + lcd.clear(); + lcd.drawSprite(12,3,27,62,(int*)move); + lcd.drawSprite(20,33,14,43,(int*)press_start); + lcd.refresh(); + if(pad.check_event(Gamepad::A_PRESSED) == true){ + currentInstruction = Life1; // sets current instruction = Life1 if start button is pressed + } + break; + case Life1: + // draws the first instrcution + lcd.clear(); + lcd.drawSprite(1,0,47,83 ,(int *)instruction1); + lcd.drawSprite(11,11,26,63 ,(int *)objective); + lcd.drawSprite(73,18,5,3 ,(int *)right_arrow); + //lcd.drawSprite(6,4,37,1,(int *)instruction_side); + lcd.refresh(); + if(pad.get_direction() == E){ + currentInstruction = Life2; // sets current instruction = Life2 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life2: + lcd.clear(); + // draws the second instrcution + lcd.drawSprite(1,0,47,83 ,(int *)instruction1); + lcd.drawSprite(12,11,27,60 ,(int *)three_mission); + lcd.drawSprite(73,18,5,3 ,(int *)right_arrow); + lcd.drawSprite(8,18,5,3 ,(int *)left_arrow); + // lcd.drawSprite(6,4,37,1,(int *)instruction_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life1; // sets current instruction = Life1 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life3; // sets current instruction = Life3 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life3: + // draws the third instrcution + lcd.clear(); + lcd.drawSprite(1,0,47,83 ,(int *)instruction1); + lcd.drawSprite(16,11,26,53 ,(int *)difficulty); + lcd.drawSprite(73,18,5,3 ,(int *)right_arrow); + lcd.drawSprite(8,18,5,3 ,(int *)left_arrow); + lcd.drawSprite(6,4,37,1,(int *)instruction_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life2; // sets current instruction = Life2 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life4; // sets current instruction = Life4 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life4: + // draws the fourth instrcution + lcd.clear(); + lcd.drawSprite(1,0,47,83 ,(int *)instruction1); + lcd.drawSprite(8,11,26,68 ,(int *)sstriker); + lcd.drawSprite(73,18,5,3 ,(int *)right_arrow); + lcd.drawSprite(8,18,5,3 ,(int *)left_arrow); + lcd.drawSprite(6,4,37,1,(int *)instruction_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life3; // sets current instruction = Life3 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life5; // sets current instruction = Life5 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life5: + // draws the first and second game rules + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.drawSprite(6,16,13,75 ,(int *)rule_one); + lcd.drawSprite(7,32,13,69 ,(int *)rule_two); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life4; // sets current instruction = Life4if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life6; // sets current instruction = Life6if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life6: + // draws the third game rule + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(5,15,31,76 ,(int *)rule_three); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life5; // sets current instruction = Life5 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life7; // sets current instruction = Life7 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life7: + // draws the fourth game rule + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(5,15,31,76 ,(int *)rule_four); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life6; // sets current instruction = Life6 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life8; // sets current instruction = Life8 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life8: + // draws the fifth game rule + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(5,15,31,76 ,(int *)rule_five); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life7; // sets current instruction = Life7 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life9; // sets current instruction = Life9 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life9: + // draws the page one of the sixth game rule + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(5,15,31,76 ,(int *)rule_six); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life8; // sets current instruction = Life8 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life10; // sets current instruction = Life10 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life10: + // draws the page two of the sixth game rule + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(5,15,13,76 ,(int *)rule_six_two); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.refresh(); + if(pad.get_direction() == W){ + currentInstruction = Life9; // sets current instruction = Life9 if joystick moves to the left + } + if(pad.get_direction() == E){ + currentInstruction = Life11; // sets current instruction = Life11 if joystick moves to the right + } + wait(1.0f/fps); + break; + case Life11: + while(pad.check_event(Gamepad::A_PRESSED) == false){ + // draws the goodluck page & makes the hat flash + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.drawSprite(4,15,14,76 ,(int *)goodluck); + lcd.drawSprite(14,31,14,43 ,(int *)press_start); + lcd.drawSprite(59,31,14,22 ,(int *)hat); + lcd.refresh(); + wait(0.5); + lcd.clear(); + lcd.drawSprite(6,5,8,74 ,(int *)game_rules); + lcd.drawSprite(2,2,1,82 ,(int *)game_top); + lcd.drawSprite(3,1,48,1 ,(int *)game_side); + lcd.drawSprite(2,46,1,82 ,(int *)game_top); + lcd.drawSprite(82,1,48,1 ,(int *)game_side); + lcd.drawSprite(4,15,14,76 ,(int *)goodluck); + lcd.drawSprite(14,31,14,43 ,(int *)press_start); + lcd.refresh(); + wait(0.5); + if(pad.get_direction() == W){ + currentInstruction = Life10; // sets current instruction = Life10 if joystick moves to the left + break; + } + if(pad.check_event(Gamepad::A_PRESSED) == true){ + currentInstruction = Life12; // sets current instruction = Life12 if joystick moves to the right + break; + } + wait(1.0f/fps); + } + break; + case Life12: + break; + + } + } +} + + +void Instruction::mini_rules(N5110 &lcd,Gamepad &pad) +{ + +int fps = 5; // set the frames per second to 5 +Rules currentRule = Rule1; // set currentRule to Rule1 +bool end = false; + + + while(!end) { + switch(currentRule){ + case Rule1: + //draws first instrcution for minigame + lcd.clear(); + lcd.printString("Survive",5,1); + lcd.printString("the game",5,2); + lcd.printString("by dodging",5,3); + lcd.printString("the enemy",5,4); + lcd.drawSprite(72,39,9,9, (int*)x_button1); + lcd.refresh(); + if(pad.check_event(Gamepad::X_PRESSED) == true){ + currentRule = Rule2; // sets current instruction = Life1 if start button is pressed + } + break; + case Rule2: + // draws the second instrcution for minigame + lcd.clear(); + lcd.printString("Destroy",5,1); + lcd.printString("the enemy",5,2); + lcd.printString("to gain",5,3); + lcd.printString("points",5,4); + lcd.drawSprite(72,39,9,9, (int*)x_button1); + lcd.refresh(); + if(pad.check_event(Gamepad::X_PRESSED) == true){ + currentRule = Rule3; // sets current instruction = Life1 if start button is pressed + } + wait(1.0f/fps); + break; + case Rule3: + lcd.clear(); + // draws the third instruction for minigame + lcd.printString("Higher the",5,1); + lcd.printString("kills, the",5,2); + lcd.printString("greater the",5,3); + lcd.printString("score",5,4); + lcd.drawSprite(72,39,9,9, (int*)x_button1); + lcd.refresh(); + if(pad.check_event(Gamepad::X_PRESSED) == true){ + currentRule = Rule4; // sets current instruction = Life1 if start button is pressed + } + wait(1.0f/fps); + break; + case Rule4: + // draws fourth instruction for minigame + lcd.clear(); + lcd.printString("Have fun!", 15, 2); + lcd.drawSprite(72,39,9,9, (int*)x_button1); + lcd.refresh(); + if(pad.check_event(Gamepad::X_PRESSED) == true){ + end = true; // sets current instruction = Life1 if start button is pressed + } + wait(1.0f/fps); + break; + } + } + } + + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Instruction/Instruction.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,42 @@ +#ifndef INSTRUCTION_H +#define INSTRUCTION_H + +#include "Gamepad.h" +#include "N5110.h" +#include "mbed.h" + +/** Instruction Class + * @brief Instruction and Game Rules page + * @author Rex Roshan Raj + */ +class Instruction +{ + +public: + + /** Constructor */ + Instruction(); + + /** Destructor */ + ~Instruction(); + + /** Draws instruction + * @param N5110 lcd + * @param Gamepad pad + * @brief Draws all the instruction and the rules of the game + */ + void rules(N5110 &lcd,Gamepad &pad); + + /** Draws guidelines + * @param N5110 lcd + * @param Gamepad pad + * @brief Draws all the guidelines for the minigame + */ + void mini_rules(N5110 &lcd,Gamepad &pad); + + +private: + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MiniEnemy/MiniEnemy.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,123 @@ +#include "MiniEnemy.h" + +// nothing doing in the constructor and destructor +MiniEnemy::MiniEnemy() +{ + +} + +MiniEnemy::~MiniEnemy() +{ + +} + +// first enemy sprite +int e1 [7][8] = { + +{0,1,1,0,0,0,0,1}, +{0,0,0,1,1,1,1,1}, +{0,0,1,0,0,1,1,0}, +{0,1,0,0,1,1,1,0}, +{0,0,1,0,0,1,1,0}, +{0,0,0,1,1,1,1,1}, +{0,1,1,0,0,0,0,1}, + +}; + +void MiniEnemy:: init() +{ + _score = 0; // initial score + _fast = 1; // initial speed + _health = 0; // initial health +} + +Vector2D MiniEnemy::location() +{ + + int a = rand() % 33; // randomise initial direction. + int b = rand() % 40; // randomise initial direction. + + _location.x = a + 42; // starts from halfway of the screen + _location.y = b; + + Vector2D velocity = {_location.x, _location.y}; + return velocity; +} + +void MiniEnemy::enemy(N5110 &lcd) +{ + + // draws the first enemy + lcd.drawSprite(_location.x,_location.y,7,8,(int *)e1); +} + +void MiniEnemy::update() // moves the position of the enemy when the enemy dies +{ + + _location.x -=_fast; // moves the y-position downwards + + +} +void MiniEnemy::add_score() +{ + // increments the value of score by 1 + _score++; +} +int MiniEnemy::get_score() +{ + // gets the value of score + return _score; +} + +void MiniEnemy::add_health() +{ + // increments the value of score by 1 + _health++; +} + +void MiniEnemy::add_fast() +{ + // increments the value of fast by 1 + if (_fast <= 7){ + _fast++; + } +} + +int MiniEnemy::get_fast() +{ + // gets the value of score + return _fast; +} + +int MiniEnemy::set_fast() +{ + // sets the fast to be zero + _fast = 0; + return _fast; +} + +int MiniEnemy::get_health() +{ + // gets the value of score + return _health; +} + +int MiniEnemy::set_health() +{ + // sets the health to be zero + _health = 0; + return _health; +} + +Vector2D MiniEnemy::get_enemy_pos() { + //gets the position of the first enemy + Vector2D e = {_location.x,_location.y}; + return e; +} + +void MiniEnemy::set_enemy_pos(Vector2D e) +{ + //sets the position of the first enemy of stage 2 + _location.x = e.x; + _location.y = e.y; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MiniEnemy/MiniEnemy.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,100 @@ +#ifndef MINIENEMY_H +#define MINIENEMY_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +/** MiniEnemy Class + * @brief Enemy for the minigame + * @author Rex Roshan Raj + */ +class MiniEnemy +{ + +public: + /** Constructor */ + MiniEnemy(); + + /** Destructor */ + ~MiniEnemy(); + + /** Initialises the parameters */ + void init(); + + /** Generates the location + * @brief Generates and sets the location of the enemy once it has been hit + */ + Vector2D location(); + + /** Draws the enemy + * @param N5110 lcd + * @brief Draws the enemy in stage one + */ + void enemy(N5110 &lcd); + + /** Updates the movement + * @brief Changes the y position for animation once the enemy has died + */ + void update(); + + /** Adds the value of score by 1 */ + void add_score(); + + /** Gets the value of the score + * @returns value in range 0 to 10 + */ + int get_score(); + + /** Adds the value of health by 1 */ + void add_health(); + + /** Gets the value of the health + * @returns value in range 0 to 5 + */ + int get_health(); + + /** Sets the value of the health + * @returns value of 0 + */ + int set_health(); + + /** Adds 1 to movement speed*/ + void add_fast(); + + /** Gets the value of the fast + * @returns value in range 1 to 7 + */ + int get_fast(); + + /** Sets the value of the fast + * @returns value in range 0 + */ + int set_fast(); + + /** Gets the position of the enemy + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_enemy_pos(); + + /** Sets the position of the enemy + * @param position of the enemy + */ + void set_enemy_pos(Vector2D e); + + +private: + + // methods + Vector2D _location; + int a; + int b; + int x; + int y; + int _fast; + int _score; + int _health; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MiniGame/MiniGame.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,320 @@ +#include "MiniGame.h" + +MiniGame::MiniGame() +{ + +} + +MiniGame::~MiniGame() +{ + +} + +// Draws explosion +int explosions [23] [23] = { + +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0}, +{0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0}, +{0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0}, +{0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0}, +{0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0}, +{0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0}, +{0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0}, +{0,1,1,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0}, +{0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0}, +{0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, +{0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1}, +{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1}, +{0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0}, +{0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, +{0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0}, +{0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, +{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, +{0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,0,0}, +{0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0}, +{0,0,0,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,0}, +{0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, + +}; + + +void MiniGame::init(int spacecraft_xpos,int spacecraft_ypos,int beam_size,int u_cloudx, int u_cloudy, int l_cloudx, int l_cloudy) +{ + // initialise the game parameters + _spacecraft_xpos = spacecraft_xpos; + _spacecraft_ypos = spacecraft_ypos; + + _beam_size = beam_size; + + _u_cloudx = u_cloudx; + _u_cloudy = u_cloudy; + _l_cloudx = l_cloudx; + _l_cloudy = l_cloudy; + + _p1.init(_spacecraft_xpos,_spacecraft_ypos); + _e1.location(); + _e1.init(); + _b1.init_u(_u_cloudx, _u_cloudy); + _b1.init_l(_l_cloudx, _l_cloudy); + _stage = 0; + _score = 0; +} + +void MiniGame::read_input(Gamepad &pad) +{ + _d = pad.get_direction(); // Get the direction of the joystick + _mag = pad.get_mag(); // Get the magnitude value + _R = pad.check_event(Gamepad::R_PRESSED); // Check if the R button is being pressed + _L = pad.check_event(Gamepad::L_PRESSED); // Check if the L button is being pressed + +} + +void MiniGame::draw_minigame(Gamepad &pad,N5110 &lcd) +{ + // draw the background of the game + _b1.background(lcd); + + draw_kills(lcd); + // player spacecraft + _p1.character(lcd); + // first enemy + _e1.enemy(lcd); + // player spacecraft beam + _beam.draw(lcd); + +} + +void MiniGame::update_minigame(Gamepad &pad,N5110 &lcd) +{ + check_playerbeam_collision(pad); // Check if L/R is being pressed to initiate the player beam + // it displays the right value + _p1.update(_d,_mag); // Player spacecraft movement update + _beam.update(); // Player spacecraft's beam update + _e1.update(); + + _b1.update(); // Background movement update + + add_counter(); + add_speed(); + + check_cloud_wall_collision(pad); + check_wall_collision(pad); + + check_enemy_collisions(pad); // Check if the player spacecraft beam collides with the enemy spacecraft + check_player_collision(pad); + + // Animations and sound effect for the both the player's and enemy' spacecraft when they are dead + spacecraft_dead(lcd,pad); + enemy_dead(lcd,pad); + draw_kills(lcd); + +} + +void MiniGame::check_playerbeam_collision(Gamepad &pad) // check if player's spacecraft beam has collided with the edges of screen or enemy +{ + Vector2D p1_pos = _p1.get_pos(); // Get player's spacecraft position + Vector2D beam_pos = _beam.get_pos(); // Get player's spacecraft beam position + + if((_R == true)|| (_L == true)){ + if ((beam_pos.x + _beam_size > WIDTH) || (spacebeam == true)){ // if hits the enemy or the wall + _beam.init(_beam_size,p1_pos.x,p1_pos.y); + _R = false; // Then set the boolean _R and _L to false + _L = false; + } + } +} + +void MiniGame::check_player_collision(Gamepad &pad) // check if the player spacecraft has collided with enemy +{ + Vector2D p1_pos = _p1.get_pos(); // Get player's spacecraft position + Vector2D e1_pos = _e1.get_enemy_pos(); // Get enemy position + + if ( + (e1_pos.y >= p1_pos.y) && //top + (e1_pos.y <= p1_pos.y + 11) && //bottom + (e1_pos.x >= p1_pos.x) && //left + (e1_pos.x <= p1_pos.x + 9) + ) { + _stage = 11; + } + //write new attributes + _e1.set_enemy_pos(e1_pos); +} + +void MiniGame::check_cloud_wall_collision(Gamepad &pad) +{ + Vector2D upper_pos = _b1.get_pos_upper(); + Vector2D lower_pos = _b1.get_pos_lower(); + + if (upper_pos.x + 6 >= (WIDTH-1)) { // upper cloud // right side + upper_pos.x = 0; + } + else if (lower_pos.x + 6 >= (WIDTH-1) ) { // lower cloud // right side + lower_pos.x = 0; + } + _b1.set_pos_upper(upper_pos); + _b1.set_pos_lower(lower_pos); +} + +void MiniGame::check_enemy_collisions(Gamepad &pad) +{ + // read current enemy spacecraft's and player spacecraft's beam attributes + Vector2D beam_pos = _beam.get_pos(); + Vector2D e1_pos = _e1.get_enemy_pos(); + + // see if player's spacecraft beam has hit the enemy's spacecraft by checking for overlaps + if ( + (beam_pos.y >= e1_pos.y) && //top + (beam_pos.y <= e1_pos.y + 7) && //bottom + (beam_pos.x + _beam_size >= e1_pos.x) && //left + (beam_pos.x + _beam_size <= e1_pos.x + 8) //right + ) { + // add first enemy health + _e1.add_health(); + spacebeam = true; + // audio feedback + pad.tone(1000.0,0.1); + } + + // write new attributes + _beam.set_pos(beam_pos); +} + +void MiniGame::check_wall_collision(Gamepad &pad) +{ + // read current enemy attributes for boss in stage three + Vector2D e1_pos = _e1.get_enemy_pos(); + + // check if hit top wall + if (e1_pos.y + 6 <= 1) { // 1 due to 1 pixel boundary + _e1.location(); + } + // check if hit bottom wall + else if (e1_pos.y + 6 >= (HEIGHT-1) ) { // bottom pixel is 47 + _e1.location(); + // check if hit right wall + }else if (e1_pos.x + 6 >= (WIDTH-1) ) { // right pixel is 83 + _e1.location(); + // check if left right wall + }else if (e1_pos.x + 6 <= 1) { // full width + _e1.location(); + } + +} + +void MiniGame::spacecraft_dead(N5110 &lcd, Gamepad &pad) // animation when the player's spacecraft is dead in stage one +{ + int p1_health = _p1.get_health(); // Gets the health of the player spacecraft + Vector2D p1_pos = _p1.get_pos(); // Gets the position of the player's spacecraft + + if (_stage == 11){ + + // explodes and outputs sound if the enemy is dead + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosions); + pad.tone(1000.0,0.5); + pad.tone(800.0,0.5); + pad.tone(600.0,0.5); + pad.tone(400.0,0.5); + wait(0.5); + lcd.refresh(); + wait(0.1); + lcd.drawSprite(p1_pos.x-5,p1_pos.y-7,23,23,(int *)explosions); + Vector2D v = {p1_pos.x, p1_pos.y}; + while(v.y < 34){ + _p1.update_move(); + v = _p1.get_pos(); + lcd.drawSprite(v.x-5,v.y-7,23,23,(int *)explosions); + wait(0.1); + } + _stage = 12; // mission one fail + lcd.refresh(); + } + +} + +void MiniGame::enemy_dead(N5110 &lcd, Gamepad &pad){ // animation when the enemy is dead in stage one + + int e1_health = _e1.get_health(); // Gets the health of the enemy + Vector2D e1_pos = _e1.get_enemy_pos(); // Gets the position of the enemy + + if (e1_health == 5){ + // explodes and outputs sound if the enemy is dead + _e1.add_score(); + _e1.location(); + _e1.set_health(); + score = true; + } + +} + + +void MiniGame::add_speed() +{ + if ( _counter == 200){ + _e1.add_fast(); + set_counter(); + } + } + +void MiniGame::draw_kills(N5110 &lcd) +{ + int score = _e1.get_score(); + + char buffer2[14]; + sprintf(buffer2,"%2d",score); + lcd.printString(buffer2,1,0); + +} + +void MiniGame::draw_score(N5110 &lcd) +{ + int i = _e1.get_score(); + + if (i <= 5){ + _score = i * 50; + } else if (i > 5 && i <= 10){ + _score = 250 + (i - 5) * 75; + } else if (i > 10 && i <= 15){ + _score = 625 + (i - 10) * 100; + } else if (i > 15 && i <= 20){ + _score = 1125 + (i - 15) * 125; + } else if (i > 20 && i <= 25){ + _score = 1750 + (i - 20) * 150; + } else if (i > 25 && i <= 30){ + _score = 2500 + (i - 25) * 175; + } else if (i > 30){ + _score = 3375 + (i - 30) * 200; + } + + // print to LCD i + char buffer1[14]; + sprintf(buffer1,"%2d",_score); + lcd.printString("Score: ",8,5); + lcd.printString(buffer1,WIDTH/2 + 5,5); // font is 8 wide, so leave 4 pixel gape from middle assuming two digits +} + +int MiniGame::get_game_stage() { + int stage = _stage; + return stage; // Gets the value of the stage +} + +void MiniGame::add_counter() { + + _counter ++; +} +int MiniGame::get_counter() { + + int counter = _counter; + return counter; + +} + +int MiniGame::set_counter() { + + _counter = 0; + return _counter; + +} + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MiniGame/MiniGame.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,117 @@ +#ifndef MINIGAME_H +#define MINIGAME_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Background.h" +#include "MiniEnemy.h" +#include "Beam.h" +#include "Spacecraft.h" + +#define GAP 2 + +/** GameEngine Class + * @brief The game engine for the game + * @author Rex Roshan Raj + */ +class MiniGame +{ + +public: + + /** Constructor */ + MiniGame(); + + /** Destructor */ + ~MiniGame(); + + /** Initialises the parameters + * @param spacecraft x pos + * @param spacecraft y pos + * @param beam_size + */ + void init(int spacecraft_xpos,int spacecraft_ypos,int beam_size,int u_cloudx, int u_cloudy, int l_cloudx, int l_cloudy); + + /** Read the input + * @param Gamepad pad + * @brief Reads the input from the Gamepad + */ + void read_input(Gamepad &pad); + + /** Draws objects in minigame + * @param N5110 lcd + * @brief Draws the characters and the beams involved in the minigame + */ + void draw_minigame(Gamepad &pad,N5110 &lcd); + + /** Updates minigame + * @param Gamepad pad + * @param N5110 lcd + */ + void update_minigame(Gamepad &pad,N5110 &lcd); + + /** Draws the score + * @param N5110 lcd + * @brief Outputs the score obtained by the player + */ + void draw_score(N5110 &lcd); + + /** Gets the game stage + * @brief Gets the current stage of the game + * @return stage + */ + int get_game_stage(); + +private: + + void check_cloud_wall_collision(Gamepad &pad); // check if the background has collided with the wall + void check_wall_collision(Gamepad &pad); // check if the enemy has collided with the wall + void check_player_collision(Gamepad &pad); // Check if the player has collided with the enemy + void check_enemy_collisions(Gamepad &pad); // check if the player spacecraft beam collided with the enemy in minigame + void enemy_dead(N5110 &lcd,Gamepad &pad); // check if enemy spacecraft is dead + void spacecraft_dead(N5110 &lcd,Gamepad &pad); // check if the player spacecraft is dead + void check_playerbeam_collision(Gamepad &pad); // check if the player's spacecraft beam collided with the wall + + void add_speed(); // adds the speed + void add_counter(); // adds the counter + + void draw_kills(N5110 &lcd); // draws the number of kills + + int _spacecraft_xpos; // x position of the spacecrafts + int _spacecraft_ypos; // y position of the spacecrafts + + int _u_cloudx; + int _u_cloudy; + + int _l_cloudx; + int _l_cloudy; + + int _p1x; + int get_counter(); // value of the counter + int _counter; + int set_counter(); + + Beam _beam; // Player beam + + int _beam_size; // beam size in minigame + + Direction _d; + float _mag; + + bool _L; + bool _R; + bool spacebeam; + bool score; + + + Spacecraft _p1; // player spacecraft + MiniEnemy _e1; // Minigame enemy + Background _b1; // Background + + int _stage; + int _score; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Music/Music.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,67 @@ +#include "Music.h" + +Music::Music() +{ + +} + +Music::~Music() +{ + +} + +void Music::intro_song(Gamepad &pad) // introduction song for the game +{ + while(pad.check_event(Gamepad::START_PRESSED) == false){ + pad.tone(293.665, 2); + wait(0.8); // thread wait so that two loops can simulatneously run + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} // break if start button has been pressed + pad.tone(311.127, 2); + wait(0.8); + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + pad.tone(329.628, 2); + wait(0.8); + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + pad.tone(349.228, 2); + wait(0.8); + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + } +} + +void Music::mission_success(Gamepad &pad) // success song +{ + //triplets + pad.tone(207.65,0.18); + wait(0.2); + pad.tone(207.65,0.18); + wait(0.2); + pad.tone(207.65,0.18); + wait(0.2); + // 3 beats + pad.tone(261.63,0.28); + wait(0.3); + pad.tone(207.65,0.28); + wait(0.3); + pad.tone(261.63,0.28); + wait(0.3); + pad.tone(261.63,0.28); + wait(0.30); + pad.tone(207.65,0.28); + wait(0.30); + pad.tone(261.63,0.28); + wait(0.30); + pad.tone(311.13,1.2); + wait(1.2); + wait(2.4); +}; + +void Music::mission_fail(Gamepad &pad) // failure song +{ + pad.tone(233.0,0.5); + wait(0.5); + pad.tone(184.0,0.5); + wait(0.5); + pad.tone(174.0,2.0); + wait(1.0); + +}; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Music/Music.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,43 @@ +#ifndef MUSIC_H +#define MUSIC_H + +#include "Gamepad.h" +#include "mbed.h" +#include "rtos.h" + +/** Music Class + * @brief Plays songs + * @author Rex Roshan Raj + */ +class Music +{ + +public: + + /** Constructor */ + Music(); + + /** Destructor */ + ~Music(); + + /** Plays introduction song + * @param Gamepad pad + */ + void intro_song(Gamepad &pad); + + /** Plays mission success song + * @param Gamepad pad + */ + void mission_success(Gamepad &pad); + + /** Plays mission fail song + * @param Gamepad pad + */ + void mission_fail(Gamepad &pad); + +private: + Thread Thread; + +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/N5110.lib Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/eencae/code/N5110/#93355c01e261
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Solar.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,345 @@ +// Sprites for drawings used in the main file + +// title screen +int screen [48][71] = { + +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,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the word one +int m_one [7][19] = { + +{0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, +{1,1,1,1,1,0,1,1,0,0,0,0,1,0,1,1,1,1,1}, +{1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0}, +{1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,1,1,1,1}, +{1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0}, +{1,1,1,1,1,0,1,0,0,0,0,1,1,0,1,1,1,1,1}, +{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, + +}; + +// the word two +int m_two [5][18] = { + +{1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1}, +{0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1}, +{0,0,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,1}, +{0,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,1}, +{0,0,1,0,0,0,1,0,0,0,0,1,0,1,1,1,1,1}, + +}; +// the word three +int m_three [5] [29] = { + +{1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1}, +{0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1}, +{0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,1,1,1,1,1}, + +}; + +// party poppers +int party_popper [25][84] = { +{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0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1,0,0,1,1,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0}, + +}; + +// x button +int x_button [9][9] = { + +{0,0,1,1,1,1,1,0,0}, +{0,1,0,0,0,0,0,1,0}, +{1,0,1,0,0,0,1,0,1}, +{1,0,1,1,0,1,1,0,1}, +{1,0,0,1,1,1,0,0,1}, +{1,0,1,1,0,1,1,0,1}, +{1,0,1,0,0,0,1,0,1}, +{0,1,0,0,0,0,0,1,0}, +{0,0,1,1,1,1,1,0,0}, + +}; + +// y button +int y_button [9][9] = { + +{0,0,1,1,1,1,1,0,0}, +{0,1,0,0,0,0,0,1,0}, +{1,0,1,0,0,0,1,0,1}, +{1,0,1,0,0,0,1,0,1}, +{1,0,1,1,1,1,1,0,1}, +{1,0,0,0,1,0,0,0,1}, +{1,0,0,0,1,0,0,0,1}, +{0,1,0,0,0,0,0,1,0}, +{0,0,1,1,1,1,1,0,0}, + +}; + +// right arrow +int r_arrow [5][3] = { + + {1,0,0}, + {1,1,0}, + {1,1,1}, + {1,1,0}, + {1,0,0}, + +}; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Spacecraft/Spacecraft.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,112 @@ +#include "Spacecraft.h" + +// nothing doing in the constructor and destructor +Spacecraft::Spacecraft() +{ + +} + +Spacecraft::~Spacecraft() +{ + +} + +// sprite of the player spacecraft +int H_spacecraft [11][11] = { + + { 0,0,1,0,0,1,0,0,0,0,0 }, + { 0,1,1,1,1,1,1,0,0,0,0 }, + { 0,0,1,0,0,1,0,0,0,0,0 }, + { 0,0,0,1,0,0,1,0,0,0,0 }, + { 0,1,1,0,0,0,0,1,1,0,0 }, + { 1,1,1,1,1,1,1,1,1,1,1 }, + { 0,1,1,1,1,1,1,1,1,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0 }, + { 0,0,1,1,1,1,0,0,0,0,0 }, + { 0,1,1,1,1,1,1,0,0,0,0 }, + { 0,0,1,0,0,1,0,0,0,0,0 }, + + +}; + +void Spacecraft::init(int x,int y) // initialise the x and y position +{ + _x = x; // default x position + _y = y; // default y position + _speed = 1; // default speed + _health = 0; // start health from zero + +} + +void Spacecraft::character(N5110 &lcd) +{ + // draw the player's spacecraft in screen buffer. + lcd.drawSprite(_x,_y,11,11,(int *)H_spacecraft); +} + + +void Spacecraft::update(Direction d,float mag) +{ + _speed = int(mag*5.0f); // scale is arbitrary, could be changed in future + + // update x and y value depending on the direction of the movement + // North is decrement as origin is at the top-left so decreasing moves up + // East is increment and West is decrement + if (d == N) { + _y-=_speed; + } else if (d == S) { + _y+=_speed; + } else if (d == E) { + _x+=_speed; + } else if (d == W) { + _x-=_speed; + } else if (d == NE) { + _y-=_speed; + _x+=_speed; + } else if (d == SE) { + _y+=_speed; + _x+=_speed; + } else if (d == NW) { + _y-=_speed; + _x-=_speed; + } else if (d == SW) { + _y+=_speed; + _x-=_speed; + } + // check the y origin to ensure that the spacecraft doesn't go off screen + if (_y < 1) { + _y = 1; + } + if (_x < 1) { + _x = 1; + } + if (_y > HEIGHT - 12) { + _y = HEIGHT - 12; + } + if (_x > WIDTH - 13) { + _x = WIDTH - 13; + } +} + +void Spacecraft::update_move() // moves south when the spacecraft dies +{ + _increment = 5.0; + + _y+=_increment; +} + +void Spacecraft::add_health() +{ + _health++; // Adds health +} +int Spacecraft::get_health() +{ + return _health; // Gets the value of health +} + +Vector2D Spacecraft::get_pos() +{ + // Gets the position of the spacecraft + Vector2D p = {_x,_y}; + return p; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Spacecraft/Spacecraft.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,69 @@ +#ifndef SPACECRAFT_H +#define SPACECRAFT_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +/** Spacecraft Class + * @brief Player's spacecraft + * @author Rex Roshan Raj + */ +class Spacecraft +{ + +public: + + /** Constructor */ + Spacecraft(); + + /** Destructor */ + ~Spacecraft(); + + /** Initialise the parameters for the player's spacecraft + *@param a - x position of the enemy + *@param b - y position of the enemy + */ + void init(int x,int y); + + /** Draws the player's spacecraft + * @param N5110 lcd + */ + void character(N5110 &lcd); + + /** Updates the direction + * @param Direction d - the direction the player moves using joystick + * @param mag - magnitude of the how fast the player moves + * @brief Changes the direction based on the position of the joystick + */ + void update(Direction d,float mag); + + /** Updates move + * @brief Moves the spacecraft down when the player dies + */ + void update_move(); + + /** Adds the value of health by 1 */ + void add_health(); + + /** Gets the value of the health + * @returns value in range 0 to 6 + */ + int get_health(); + + /** Gets the position of the player's spacecraft + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos(); + +private: + + int _x; + int _y; + int _speed; + int _health; + int _increment; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpacecraftBeam/Beam.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,47 @@ +#include "Beam.h" + +Beam::Beam() +{ + +} + +Beam::~Beam() +{ + +} + +void Beam::init(int size,int a, int b) // Initialise the size, x and y position of the beam +{ + _size = size; + _x = _size; // length of the beam + _y = 1; // height of the beam + _a = a + 11; // x position of the beam + _b = b + 5; // y position of the beam +} + +void Beam::draw(N5110 &lcd) +{ + lcd.drawRect(_a,_b,_x,_y,FILL_BLACK); +} + +void Beam::update() +{ + _speed = 5.0; // sets the movement speed of the beam to be 5 + + _a+=_speed; // moves in the x direction + +} + +Vector2D Beam::get_pos() +{ + // Gets the position of the beam + Vector2D b = {_a,_b}; + return b; +} + +void Beam::set_pos(Vector2D p) +{ + // Sets the position of the beam + _a = p.x ; + _b = p.y ; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpacecraftBeam/Beam.h Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,70 @@ +#ifndef BEAM_H +#define BEAM_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Spacecraft.h" + +// gap from edge of screen +#define GAP 2 + +/** Beam Class + * @brief Player's spacecraft beam + * @author Rex Roshan Raj + */ +class Beam +{ + +public: + + /** Constructor */ + Beam(); + + /** Destructor */ + ~Beam(); + + /** Initialise the parameters for the player's spacecraft beam + *@param size - size of the beam + *@param a - x position of the spacecraft's beam + *@param b - y position of the spacecraft's beam + */ + void init(int size,int a, int b); + + /** Updates the beam + * @brief Changes the x position of the beam once it has been pressed + */ + void update(); + + /** Draws the player's spacecraft beam + * @param N5110 lcd + */ + void draw(N5110 &lcd); + + /** Gets the position of the player's spacecraft beam + * @returns a struct with x,y members which corresponds to x and y position respectively + */ + Vector2D get_pos(); + + /** Sets the position of the player's spacecraft beam + * @brief Position of the player's spacecraft beam + * @param position + */ + void set_pos(Vector2D p); + +private: + + + Spacecraft _p1; + + int _speed; + int _size; + + int _x; + int _y; + int _a; + int _b; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Trial.lib Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed-rtos/#5713cbbdb706
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,446 @@ +/* +ELEC2645 Embedded Systems Project +School of Electronic & Electrical Engineering +University of Leeds +Name: Rex Roshan Raj +Username: el17rrs +Student ID Number: 201184290 +Start Date: 25/03/2019 +End Date: 9/05/2019 +*/ + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Instruction.h" +#include "Spacecraft.h" +#include "GameEngine.h" +#include "MiniGame.h" +#include "Solar.h" +#include "Music.h" +#include "rtos.h" + +/** @file main.cpp + * @brief Contains the main code of the program. + */ + +// Structs +struct UserInput { + Direction d; + float mag; +}; + +// enum state for MainPage +enum MainPage { TitleScreen, Menu, Mini_Game, Mission }; + +// enum state for MiniState +enum MiniState { Dead, Alive }; + +// enum state for Mission state +enum MissionState {Mission1,Mission1Pass,Mission1Fail,Mission2,Mission2Pass,Mission2Fail,Mission3,Mission3Pass,Mission3Fail,Congratulations }; + +// Objects +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); // K64F - pwr from 3V3 +Gamepad pad; +Music play; +Instruction instruct; +Thread thread; +Spacecraft game; +GameEngine shoot; +MiniGame mini; + + +// Prototypes +void init(); +void mini_init(); +void welcome(); +void mini_render(); +void render_nothing(); +void render(); +void render2(); +void render3(); +void mini_rules(); +void intro(); +void instruction(); +//void intro_song(); + +bool end = false; +bool finish = false; +bool music_end = false; + + +int main() +{ + int fps = 8; // Set the frames per second = 8 + lcd.setContrast(0.4); // 0.4 appears to be a good starting point + init(); // Initialise all the parameters in GameEngine + + MainPage currentState = TitleScreen; // Initial state of MainPage + MissionState currentMission = Mission3; // Initial state of MissionState + MiniState currentMini = Alive; // Initial state of MiniState + + + while(1) { + switch(currentState){ + case TitleScreen: + // Draws the Title Screen + lcd.clear(); + lcd.refresh(); + thread.start(welcome); + intro(); + thread.terminate(); + // instruction page for the game + render_nothing(); + wait(1.0f/fps); + currentState = Menu; + break; + case Menu: + // Draws the Menu Page + lcd.clear(); + lcd.drawSprite(4,7,9,9, (int*)x_button); + lcd.drawSprite(4,23,9,9, (int*)y_button); + lcd.printString("Mission",20,1); + lcd.printString("Mini Game",20,3); + lcd.refresh(); + if (pad.check_event(Gamepad::X_PRESSED) == true){ + currentState = Mission; + end = false; + instruction(); + } else if (pad.check_event(Gamepad::Y_PRESSED) == true){ + currentState = Mini_Game; + finish = false; + mini_rules(); + } + break; + + case Mission: + // instruction page for the game + currentMission = Mission3; + while(!end){ + switch(currentMission){ + case Mission1: + shoot.read_input(pad); + shoot.update_mission_one(pad,lcd); + render(); + wait(1.0f/fps); + if(shoot.get_game_stage() == 1){ + currentMission = Mission1Fail; + break; + } + else if(shoot.get_game_stage() == 2){ + currentMission = Mission1Pass; + break; + }else { + currentMission = Mission1; + } + break; + case Mission1Fail: + lcd.clear(); + lcd.drawSprite(6,5,42,73,(int *)mission_fail); + lcd.drawSprite(51,11,7,19,(int *)m_one); + lcd.refresh(); + play.mission_fail(pad); + if (pad.check_event(Gamepad::B_PRESSED) == true){ + currentMission = Mission1; + shoot.restart_game_stage(); + init(); + } + break; + case Mission1Pass: + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *)mission_pass); + lcd.drawSprite(51,11,7,19,(int *)m_one); + lcd.refresh(); + play.mission_success(pad); + if (pad.check_event(Gamepad::A_PRESSED) == true){ + currentMission = Mission2; + shoot.restart_game_stage(); + init(); + } + break; + case Mission2: + shoot.read_input(pad); + shoot.update_mission_two(pad,lcd); + render2(); + wait(1.0f/fps); + if(shoot.get_game_stage() == 3 ){ + currentMission = Mission2Fail; + } + if(shoot.get_game_stage() == 4){ + currentMission = Mission2Pass; + } + break; + case Mission2Fail: + lcd.clear(); + lcd.drawSprite(6,5,42,73,(int *)mission_fail); + lcd.drawSprite(51,12,5,18,(int *)m_two); + lcd.refresh(); + play.mission_fail(pad); + if (pad.check_event(Gamepad::B_PRESSED) == true){ + currentMission = Mission1; + shoot.restart_game_stage(); + init(); + } + break; + case Mission2Pass: + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *)mission_pass); + lcd.drawSprite(51,12,5,18,(int *)m_two); + lcd.refresh(); + play.mission_success(pad); + if (pad.check_event(Gamepad::A_PRESSED) == true){ + currentMission = Mission3; + shoot.restart_game_stage(); + init(); + } + break; + case Mission3: + shoot.read_input(pad); + shoot.update_mission_three(pad,lcd); + render3(); + wait(1.0f/fps); + if(shoot.get_game_stage() == 5 ){ + currentMission = Mission3Fail; + } + if(shoot.get_game_stage() == 6){ + currentMission = Mission3Pass; + } + break; + case Mission3Fail: + lcd.clear(); + lcd.drawSprite(6,5,42,73,(int *)mission_fail); + lcd.drawSprite(48,12,5,29,(int *)m_three); + lcd.refresh(); + play.mission_fail(pad); + if (pad.check_event(Gamepad::B_PRESSED) == true){ + currentMission = Mission1; + shoot.restart_game_stage(); + init(); + } + break; + case Mission3Pass: + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *)mission_pass); + lcd.drawSprite(48,12,5,29,(int *)m_three); + lcd.refresh(); + play.mission_success(pad); + if (pad.check_event(Gamepad::A_PRESSED) == true){ + currentMission = Congratulations; + } + break; + case Congratulations: + for(int i = 0; i < 3; i++){ + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *) congrats); + lcd.drawSprite(0,23,25,84,(int *)party_popper); + lcd.refresh(); + wait(0.5); + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *) congrats); + lcd.refresh(); + wait(0.5); + } + while(pad.check_event(Gamepad::A_PRESSED) == false){ + lcd.clear(); + lcd.drawSprite(0,0,48,84,(int *) congrats); + lcd.drawSprite(25,28,13,36,(int *) exit1); + lcd.refresh(); + if (pad.check_event(Gamepad::A_PRESSED) == true){ + end = true; + music_end = false; + break; + } + } + break; + } + } + currentState = TitleScreen; + break; + + case Mini_Game: + mini_init(); + currentMini = Alive; + while(!finish) { + switch(currentMini){ + case Alive: + mini.read_input(pad); + mini.update_minigame(pad,lcd); + mini_render(); + wait(1.0f/fps); + if(mini.get_game_stage() == 12){ + currentMini = Dead; + break; + } + break; + + case Dead: + lcd.clear(); + lcd.printString(" Your ",0,1); + lcd.printString(" Spacecraft",4,2); + lcd.printString(" have fallen",0,3); + lcd.drawSprite(72,39,9,9, (int*)x_button); + mini.draw_score(lcd); + lcd.refresh(); + wait(1.0f/fps); + if (pad.check_event(Gamepad::X_PRESSED) == true){ + finish = true; + music_end = false; + } + break; + } + } + currentState = TitleScreen; + break; + } + } +} + +void init(){ + // need to initialise LCD,Gamepad and the Game + lcd.init(); + pad.init(); + //Initialise (x pos of player spacecraft, y pos of player spacecraft, x pos of enemy stage 1,y pos of enemy stage 1, x pos of enemy1 stage 2, y pos of enemy1 stage 2, x pos of enemy2 stage 2, y pos of enemy2 stage 2, x pos of boss stage 3, y pos of boss stage 3, beam size 1, beam size 2, motion speed) + shoot.init(WIDTH/12,HEIGHT/2-5,16,4,12,10,20,11,3,2,4); + +} + +void mini_init(){ + // need to initialise LCD,Gamepad and the Game + lcd.init(); + pad.init(); + //Initialise (x pos of player spacecraft, y pos of player spacecraft, beam size 1) + mini.init(WIDTH/12,HEIGHT/2-5,3,66,0,36,30); + +} + + +void render() +{ + // clear screen, re-draw and refresh + // Mission 1 + lcd.clear(); + shoot.draw_mission_one(pad,lcd); + lcd.refresh(); +} + +void render2() +{ + // clear screen, re-draw and refresh + // Mission 2 + lcd.clear(); + shoot.draw_mission_two(pad,lcd); + lcd.refresh(); +} + +void render3() +{ + // clear screen, re-draw and refresh + // Mission 3 + lcd.clear(); + shoot.draw_mission_three(pad,lcd); + lcd.refresh(); +} + +void welcome() +{ + + // draws the sprites until the Start button is pressed + + while ( pad.check_event(Gamepad::START_PRESSED) == false) { + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + pad.leds_on(); + lcd.drawSprite(6,0,48,71,(int *)screen); + lcd.drawSprite(21,43,5,40,(int *)start); + lcd.refresh(); + Thread::wait(800); + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + pad.leds_off(); + lcd.drawSprite(6,0,48,71,(int *)screen); + lcd.refresh(); + Thread::wait(800); + if(pad.check_event(Gamepad::START_PRESSED) == true){break;} + + } + pad.leds_off(); +} +/*void welcome() +{ + + // draws the sprites until the Start button is pressed + + while (!music_end) { + if(pad.check_event(Gamepad::START_PRESSED) == true){music_end = true; break;} + pad.leds_on(); + lcd.drawSprite(6,0,48,71,(int *)screen); + lcd.drawSprite(21,43,5,40,(int *)start); + lcd.refresh(); + wait(0.8); + if(pad.check_event(Gamepad::START_PRESSED) == true){music_end = true; break;} + pad.leds_off(); + lcd.drawSprite(6,0,48,71,(int *)screen); + lcd.refresh(); + wait(0.8); + if(pad.check_event(Gamepad::START_PRESSED) == true){music_end = true; break;} + + } + pad.leds_off(); +}*/ + + +void intro() +{ + //plays the introduction music for game + play.intro_song(pad); +} + +void instruction() +{ + // clears, draws the instrcution and game rules page and refreshes the page + pad.leds_off(); + lcd.clear(); + instruct.rules(lcd,pad); + lcd.refresh(); + + +} + +void mini_rules() +{ + lcd.clear(); + instruct.mini_rules(lcd,pad); + lcd.refresh(); +} + +void mini_render() +{ + // Mini Game + // clear screen, re-draw and refresh + lcd.clear(); + mini.draw_minigame(pad,lcd); + lcd.refresh(); +} + +void render_nothing() +{ + lcd.clear(); + lcd.refresh(); +} + +/*void intro_song() // introduction song for the game +{ + while(!music_end){ + pad.tone(293.665, 2); + if(music_end == true){break;} // break if start button has been pressed + thread.wait(1000); // thread wait so that two loops can simulatneously run + pad.tone(311.127, 2); + if(music_end == true){break;} + thread.wait(1000); + pad.tone(329.628, 2); + if(music_end == true){break;} + thread.wait(1000); + pad.tone(349.228, 2); + if(music_end == true){break;} + thread.wait(1000); + } +}*/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 09 09:49:35 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file