Nemesis game, second enemy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Enemy2.h Source File

Enemy2.h

00001 #ifndef ENEMY2_H
00002 #define ENEMY2_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Friendly.h"
00008 
00009 /** Enemy2 Class
00010 @brief Used for generating the second enemy ship in the Nemesis game. Includes drawing and updating functions. 
00011 @brief Incorporates N5110.h file by Craig A. Evans.
00012 
00013 @brief Revision 1.0
00014 
00015 @author Musallam M. M. Bseiso
00016 @date   3rd May 2017
00017 */
00018 
00019 
00020 class Enemy2
00021 {
00022 
00023 public:
00024 
00025     /// Constructor and destructor:
00026     Enemy2();
00027     ~Enemy2();
00028     
00029     
00030     ////////////////////////////////
00031     //////// PUBLIC METHODS
00032     ////////////////////////////////
00033     
00034     
00035     /** Initialize Enemy2
00036     *   
00037     *   Initializes second enemy ship x (random) & y (fixed) positions, as well as speed.
00038     */
00039     void init(int speed);
00040     
00041     
00042     /** Draw Enemy2
00043     *   
00044     *   Draws the second enemy ship onto the LCD, in accordance with the parameters initialized in the "init" method.
00045     *   @param N5110 - nokia LCD library
00046     *   @param lcd - pointer to nokia LCD library
00047     */
00048     void draw(N5110 &lcd);
00049     
00050     
00051     /** Update Enemy2
00052     *   
00053     *   Updates the second enemy ship's x and y position. X and y positions are altered by adding speeds.
00054     */
00055     void update();
00056 
00057 
00058     /** Get Enemy2 Position
00059     *
00060     *   Obtains the position (x and y coordinates) of the second enemy ship at any given time, into a two-dimensional vector.
00061     *   @returns p - the Vector2D of the parameters
00062     */
00063     Vector2D get_pos();
00064     
00065 private:
00066 
00067 
00068     ////////////////////////////////
00069     //////// PRIVATE VARIABLES
00070     ////////////////////////////////
00071     
00072 
00073     /// Vector2D that stores two speeds, one for x and one for y.
00074     Vector2D _velocity;
00075     
00076     /// Integer variables to store the x and y coordinates of the friendly ship:
00077     int _x;
00078     int _y;
00079     
00080 };
00081 #endif