Nemesis game, second enemy

Committer:
musallambseiso
Date:
Tue May 02 22:14:15 2017 +0000
Revision:
7:56bb2fb8b9f3
Child:
8:722dec08a18c
Added Doxygen, tidied code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
musallambseiso 7:56bb2fb8b9f3 1 #ifndef ENEMY2_H
musallambseiso 7:56bb2fb8b9f3 2 #define ENEMY2_H
musallambseiso 7:56bb2fb8b9f3 3
musallambseiso 7:56bb2fb8b9f3 4 #include "mbed.h"
musallambseiso 7:56bb2fb8b9f3 5 #include "N5110.h"
musallambseiso 7:56bb2fb8b9f3 6 #include "Gamepad.h"
musallambseiso 7:56bb2fb8b9f3 7 #include "Friendly.h"
musallambseiso 7:56bb2fb8b9f3 8
musallambseiso 7:56bb2fb8b9f3 9 class Enemy2
musallambseiso 7:56bb2fb8b9f3 10 {
musallambseiso 7:56bb2fb8b9f3 11
musallambseiso 7:56bb2fb8b9f3 12 public:
musallambseiso 7:56bb2fb8b9f3 13
musallambseiso 7:56bb2fb8b9f3 14 /// Constructor and destructor:
musallambseiso 7:56bb2fb8b9f3 15 Enemy2();
musallambseiso 7:56bb2fb8b9f3 16 ~Enemy2();
musallambseiso 7:56bb2fb8b9f3 17
musallambseiso 7:56bb2fb8b9f3 18
musallambseiso 7:56bb2fb8b9f3 19 ////////////////////////////////
musallambseiso 7:56bb2fb8b9f3 20 //////// PUBLIC METHODS
musallambseiso 7:56bb2fb8b9f3 21 ////////////////////////////////
musallambseiso 7:56bb2fb8b9f3 22
musallambseiso 7:56bb2fb8b9f3 23
musallambseiso 7:56bb2fb8b9f3 24 /** Initialize Enemy2
musallambseiso 7:56bb2fb8b9f3 25 *
musallambseiso 7:56bb2fb8b9f3 26 * Initializes second enemy ship x (random) & y (fixed) positions, as well as speed.
musallambseiso 7:56bb2fb8b9f3 27 */
musallambseiso 7:56bb2fb8b9f3 28 void init(int speed);
musallambseiso 7:56bb2fb8b9f3 29
musallambseiso 7:56bb2fb8b9f3 30
musallambseiso 7:56bb2fb8b9f3 31 /** Draw Enemy2
musallambseiso 7:56bb2fb8b9f3 32 *
musallambseiso 7:56bb2fb8b9f3 33 * Draws the second enemy ship onto the LCD, in accordance with the parameters initialized in the "init" method.
musallambseiso 7:56bb2fb8b9f3 34 */
musallambseiso 7:56bb2fb8b9f3 35 void draw(N5110 &lcd);
musallambseiso 7:56bb2fb8b9f3 36
musallambseiso 7:56bb2fb8b9f3 37
musallambseiso 7:56bb2fb8b9f3 38 /** Update Enemy2
musallambseiso 7:56bb2fb8b9f3 39 *
musallambseiso 7:56bb2fb8b9f3 40 * Updates the second enemy ship's x and y position. X and y positions are altered by adding speeds.
musallambseiso 7:56bb2fb8b9f3 41 */
musallambseiso 7:56bb2fb8b9f3 42 void update();
musallambseiso 7:56bb2fb8b9f3 43
musallambseiso 7:56bb2fb8b9f3 44
musallambseiso 7:56bb2fb8b9f3 45 /** Get Enemy2 Position
musallambseiso 7:56bb2fb8b9f3 46 *
musallambseiso 7:56bb2fb8b9f3 47 * Obtains the position (x and y coordinates) of the second enemy ship at any given time, into a two-dimensional vector.
musallambseiso 7:56bb2fb8b9f3 48 * @returns p - the Vector2D of the parameters
musallambseiso 7:56bb2fb8b9f3 49 */
musallambseiso 7:56bb2fb8b9f3 50 Vector2D get_pos();
musallambseiso 7:56bb2fb8b9f3 51
musallambseiso 7:56bb2fb8b9f3 52 private:
musallambseiso 7:56bb2fb8b9f3 53
musallambseiso 7:56bb2fb8b9f3 54
musallambseiso 7:56bb2fb8b9f3 55 ////////////////////////////////
musallambseiso 7:56bb2fb8b9f3 56 //////// PRIVATE VARIABLES
musallambseiso 7:56bb2fb8b9f3 57 ////////////////////////////////
musallambseiso 7:56bb2fb8b9f3 58
musallambseiso 7:56bb2fb8b9f3 59
musallambseiso 7:56bb2fb8b9f3 60 /// Vector2D that stores two speeds, one for x and one for y.
musallambseiso 7:56bb2fb8b9f3 61 Vector2D _velocity;
musallambseiso 7:56bb2fb8b9f3 62
musallambseiso 7:56bb2fb8b9f3 63 /// Integer variables to store the x and y coordinates of the friendly ship:
musallambseiso 7:56bb2fb8b9f3 64 int _x;
musallambseiso 7:56bb2fb8b9f3 65 int _y;
musallambseiso 7:56bb2fb8b9f3 66
musallambseiso 7:56bb2fb8b9f3 67 };
musallambseiso 7:56bb2fb8b9f3 68 #endif