Matis Requis 201241242

Dependencies:   mbed

Tempest Game

Game Screen

https://os.mbed.com/media/uploads/MatisRequis/tempest_board_wiki.png The board is made of 12 columns. The Hero stays at the top of the column

Game Controls

https://os.mbed.com/media/uploads/MatisRequis/gamepad_buttons.png

To control the hero spaceship point the joystick to the column you want the hero to go to.

Press the A button to shoot a bullet in the column you are currently in.

Committer:
MatisRequis
Date:
Wed May 27 05:53:03 2020 +0000
Revision:
12:1f1907ebebeb
Parent:
10:2ae9d4145410
Final Submission. I have read and agreed with Statement of Academic Integrity

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MatisRequis 2:d59a92e65bd9 1 #ifndef BULLET_H
MatisRequis 2:d59a92e65bd9 2 #define BULLET_H
MatisRequis 2:d59a92e65bd9 3
MatisRequis 10:2ae9d4145410 4 // Included Libraries
MatisRequis 2:d59a92e65bd9 5 #include "mbed.h"
MatisRequis 2:d59a92e65bd9 6 #include "N5110.h"
MatisRequis 2:d59a92e65bd9 7 #include "Gamepad.h"
MatisRequis 3:54132cf073d7 8 #include "Board.h"
MatisRequis 2:d59a92e65bd9 9
MatisRequis 10:2ae9d4145410 10
MatisRequis 10:2ae9d4145410 11 /** Bullet Class
MatisRequis 10:2ae9d4145410 12 * @brief Draws and moves the bullets
MatisRequis 10:2ae9d4145410 13 * @author Matis Requis
MatisRequis 10:2ae9d4145410 14 * @date May, 2020
MatisRequis 10:2ae9d4145410 15 */
MatisRequis 2:d59a92e65bd9 16 class Bullet {
MatisRequis 2:d59a92e65bd9 17 public:
MatisRequis 10:2ae9d4145410 18
MatisRequis 10:2ae9d4145410 19 /** Constructor */
MatisRequis 2:d59a92e65bd9 20 Bullet();
MatisRequis 10:2ae9d4145410 21
MatisRequis 10:2ae9d4145410 22 /** Destructor */
MatisRequis 2:d59a92e65bd9 23 ~Bullet();
MatisRequis 10:2ae9d4145410 24
MatisRequis 10:2ae9d4145410 25 /** Initialises the bullet
MatisRequis 10:2ae9d4145410 26 * @param column @details column the bullet spawns at
MatisRequis 10:2ae9d4145410 27 */
MatisRequis 4:8e3ba8d6d915 28 void init(int column);
MatisRequis 10:2ae9d4145410 29
MatisRequis 10:2ae9d4145410 30 /** Draws the bullet
MatisRequis 10:2ae9d4145410 31 * @param lcd @details N5110 object
MatisRequis 10:2ae9d4145410 32 */
MatisRequis 2:d59a92e65bd9 33 void draw(N5110 &lcd);
MatisRequis 10:2ae9d4145410 34
MatisRequis 10:2ae9d4145410 35 /** Updates the bullet location */
MatisRequis 4:8e3ba8d6d915 36 void update();
MatisRequis 10:2ae9d4145410 37
MatisRequis 10:2ae9d4145410 38 /** checks if the bullet needs to be deleted
MatisRequis 10:2ae9d4145410 39 * @return 1 or 0 @details returns 1 if bullet needs to be deleted
MatisRequis 10:2ae9d4145410 40 */
MatisRequis 6:037dfa5064a1 41 int checkdelete();
MatisRequis 10:2ae9d4145410 42
MatisRequis 10:2ae9d4145410 43 /** returns a vector with the bullet position
MatisRequis 10:2ae9d4145410 44 * @return bulletxy @details Vector2D structure with the bullets xy coordinates
MatisRequis 10:2ae9d4145410 45 */
MatisRequis 10:2ae9d4145410 46 Vector2D getxy();
MatisRequis 10:2ae9d4145410 47
MatisRequis 10:2ae9d4145410 48 /** returns a vector with the bullet lane and position
MatisRequis 10:2ae9d4145410 49 * @return bulletxy @details Vector2D structure with the bullets lane and position
MatisRequis 10:2ae9d4145410 50 */
MatisRequis 10:2ae9d4145410 51 Vector2D getcolumnpos();
MatisRequis 10:2ae9d4145410 52
MatisRequis 2:d59a92e65bd9 53 private:
MatisRequis 3:54132cf073d7 54 int _column;
MatisRequis 2:d59a92e65bd9 55 int _x;
MatisRequis 2:d59a92e65bd9 56 int _y;
MatisRequis 3:54132cf073d7 57 Board _board;
MatisRequis 3:54132cf073d7 58 int _currentpos;
MatisRequis 2:d59a92e65bd9 59 };
MatisRequis 2:d59a92e65bd9 60 #endif