Nemesis game, fourth enemy
Embed:
(wiki syntax)
Show/hide line numbers
Enemy4.h
00001 #ifndef ENEMY4_H 00002 #define ENEMY4_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "Friendly.h" 00008 00009 /** Enemy4 Class 00010 @brief Used for generating the fourth 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 Enemy4 00021 { 00022 00023 public: 00024 00025 /// Constructor and destructor: 00026 Enemy4(); 00027 ~Enemy4(); 00028 00029 00030 //////////////////////////////// 00031 //////// PUBLIC METHODS 00032 //////////////////////////////// 00033 00034 00035 /** Initialize Enemy4 00036 * 00037 * Initializes fourth enemy ship x (random) & y (fixed) positions, as well as speed. 00038 */ 00039 void init(int speed); 00040 00041 00042 /** Draw Enemy4 00043 * 00044 * Draws the fourth 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 Enemy4 00052 * 00053 * Updates the fourth enemy ship's x and y position. X and y positions are altered by adding speeds. 00054 */ 00055 void update(); 00056 00057 00058 /** Get Enemy4 Position 00059 * 00060 * Obtains the position (x and y coordinates) of the fourth 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
Generated on Sat Jul 16 2022 02:18:16 by
1.7.2