Nemesis game, stats
Embed:
(wiki syntax)
Show/hide line numbers
Stats.h
00001 #ifndef STATS_H 00002 #define STATS_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "Friendly.h" 00008 00009 /** Friendly Class 00010 @brief Used for drawing the weapons bar, the health bar, and the wave counter in the Nemesis game. 00011 @brief Constantly checks and redraws elements based on user input and progress in the game. 00012 @brief Incorporates N5110.h file by Craig A. Evans. 00013 00014 @brief Revision 1.0 00015 00016 @author Musallam M. M. Bseiso 00017 @date 3rd May 2017 00018 */ 00019 00020 00021 class Stats 00022 { 00023 00024 public: 00025 00026 /// Constructors and destructors: 00027 Stats(); 00028 ~Stats(); 00029 00030 00031 //////////////////////////////// 00032 //////// PUBLIC METHODS 00033 //////////////////////////////// 00034 00035 00036 /** Draw Grid 00037 * 00038 * Draws the outer rectangular border, health border, wave counter border, and weapon border onto the LCD. 00039 * @param N5110 - nokia LCD library 00040 * @param lcd - pointer to nokia LCD library 00041 */ 00042 void draw_grid(N5110 &lcd); 00043 00044 00045 /** Draw Wave Counter 00046 * 00047 * Draws the wave counter onto the LCD. 00048 * @param N5110 - nokia LCD library 00049 * @param lcd - pointer to nokia LCD library 00050 * @param wave_counter - counter that stores which wave the game is in 00051 */ 00052 void draw_wave_counter(N5110 &lcd, int wave_counter); 00053 00054 00055 /** Draw Health 00056 * 00057 * Draws the outside border of the health bar heart onto the LCD. 00058 * @param N5110 - nokia LCD library 00059 * @param lcd - pointer to nokia LCD library 00060 */ 00061 void draw_health(N5110 &lcd); 00062 00063 00064 /** Draw First Rocket 00065 * 00066 * Draws the first rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted 00067 * depending on the "state" variable. Further explained in the "check_rocket" method. 00068 * @param N5110 - nokia LCD library 00069 * @param lcd - pointer to nokia LCD library 00070 * @param state - variable that determines if line is drawn full black (1) or dotted (2) 00071 */ 00072 void draw_rocket1(N5110 &lcd, int state); 00073 00074 00075 /** Draw Second Rocket 00076 * 00077 * Draws the second rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted 00078 * depending on the "state" variable. Further explained in the "check_rocket" method. 00079 * @param N5110 - nokia LCD library 00080 * @param lcd - pointer to nokia LCD library 00081 * @param state - variable that determines if line is drawn full black (1) or dotted (2) 00082 */ 00083 void draw_rocket2(N5110 &lcd, int state); 00084 00085 00086 /** Draw Third Rocket 00087 * 00088 * Draws the third rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted 00089 * depending on the "state" variable. Further explained in the "check_rocket" method. 00090 * @param N5110 - nokia LCD library 00091 * @param lcd - pointer to nokia LCD library 00092 * @param state - variable that determines if line is drawn full black (1) or dotted (2) 00093 */ 00094 void draw_rocket3(N5110 &lcd, int state); 00095 00096 00097 /** Draw Star 00098 * 00099 * Draws the star onto the LCD. It is drawn full black or dotted depending on the "state" variable. 00100 * Further explained in the "check_rocket" method. 00101 * @param N5110 - nokia LCD library 00102 * @param lcd - pointer to nokia LCD library 00103 * @param state - variable that determines if line is drawn full black (1) or dotted (2) 00104 */ 00105 void draw_star (N5110 &lcd, int state); 00106 00107 00108 /** Check Health (high) 00109 * 00110 * Draws the health bars onto the LCD depending on how much health the player has (depending on the variable "collisons"). 00111 * If zero collisions, health bar is full, i.e the heart is filled black. As collisions increase, the health bar 00112 * goes down, i.e less of the heart is filled black. This method only deals with the health when it is high. 00113 * @param N5110 - nokia LCD library 00114 * @param lcd - pointer to nokia LCD library 00115 * @param collisions - variable that stores how many collisions have been registered 00116 */ 00117 void check_health_high(N5110 &lcd, int collisions); 00118 00119 00120 /** Check Health (low) 00121 * 00122 * Draws the health bars onto the LCD depending on how much health the player has (depending on the variable "collisons"). 00123 * If zero collisions, health bar is full, i.e the heart is filled black. As collisions increase, the health bar 00124 * goes down, i.e less of the heart is filled black. This method only deals with the health when it is low. 00125 * @param N5110 - nokia LCD library 00126 * @param lcd - pointer to nokia LCD library 00127 * @param collisions - variable that stores how many collisions have been registered 00128 */ 00129 void check_health_low(N5110 &lcd, int collisions); 00130 00131 00132 /** Check Rocket 00133 * 00134 * Draws the rockets in the weapons bar onto the LCD depending on how many the player has (depending on the variable 00135 * "ammo"). If full ammo, all 3 rockets are drawn full black, i.e drawn with the state set to 1. After one shot (ammo = 2), 00136 * the first two are still drawn full black and the third one is drawn dotted, i.e the first two are drawn with a state of 1, 00137 * and the third one is drawn with a state of 2, etc. 00138 * @param N5110 - nokia LCD library 00139 * @param lcd - pointer to nokia LCD library 00140 * @param ammo - variable that stores how many rockets are available 00141 */ 00142 void check_rocket(N5110 &lcd, int ammo); 00143 00144 00145 /** Check Star 00146 * 00147 * Draws the star in the weapons bar onto the LCD depending on if the player has one available (depending on the variable 00148 * "star"). If "star" is set to true, it is drawn full black, i.e drawn with the state set to 1, if it is set to false, it 00149 * is drawn dotted, i.e drawn with the state set to 2. 00150 * @param N5110 - nokia LCD library 00151 * @param lcd - pointer to nokia LCD library 00152 * @param star - variable that stores whether a star is available or not 00153 */ 00154 void check_star(N5110 &lcd, bool star); 00155 00156 private: 00157 00158 }; 00159 00160 #endif
Generated on Tue Jul 12 2022 22:54:50 by
1.7.2