Nemesis game third enemy

Committer:
musallambseiso
Date:
Tue May 02 22:14:22 2017 +0000
Revision:
3:ed7f3ee41871
Child:
4:bc02594c4902
Added Doxygen, tidied code

Who changed what in which revision?

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