Nemesis game, stats
Stats.h@10:c5ef17e93872, 2017-05-02 (annotated)
- Committer:
- musallambseiso
- Date:
- Tue May 02 22:13:28 2017 +0000
- Revision:
- 10:c5ef17e93872
- Parent:
- 9:b9ad5e45aebf
- Child:
- 11:deba1e6f8d78
Added Doxygen, tidied code, added second weapon type (star)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
musallambseiso | 7:cae9a95427f7 | 1 | #ifndef STATS_H |
musallambseiso | 7:cae9a95427f7 | 2 | #define STATS_H |
musallambseiso | 5:b822aaa6200d | 3 | |
musallambseiso | 5:b822aaa6200d | 4 | #include "mbed.h" |
musallambseiso | 5:b822aaa6200d | 5 | #include "N5110.h" |
musallambseiso | 5:b822aaa6200d | 6 | #include "Gamepad.h" |
musallambseiso | 5:b822aaa6200d | 7 | #include "Friendly.h" |
musallambseiso | 5:b822aaa6200d | 8 | |
musallambseiso | 7:cae9a95427f7 | 9 | class Stats |
musallambseiso | 5:b822aaa6200d | 10 | { |
musallambseiso | 5:b822aaa6200d | 11 | |
musallambseiso | 5:b822aaa6200d | 12 | public: |
musallambseiso | 10:c5ef17e93872 | 13 | |
musallambseiso | 10:c5ef17e93872 | 14 | /// Constructors and destructors: |
musallambseiso | 7:cae9a95427f7 | 15 | Stats(); |
musallambseiso | 7:cae9a95427f7 | 16 | ~Stats(); |
musallambseiso | 6:fb678d095e0a | 17 | |
musallambseiso | 10:c5ef17e93872 | 18 | |
musallambseiso | 10:c5ef17e93872 | 19 | //////////////////////////////// |
musallambseiso | 10:c5ef17e93872 | 20 | //////// PUBLIC METHODS |
musallambseiso | 10:c5ef17e93872 | 21 | //////////////////////////////// |
musallambseiso | 10:c5ef17e93872 | 22 | |
musallambseiso | 10:c5ef17e93872 | 23 | |
musallambseiso | 10:c5ef17e93872 | 24 | /** Draw Grid |
musallambseiso | 10:c5ef17e93872 | 25 | * |
musallambseiso | 10:c5ef17e93872 | 26 | * Draws the outer rectangular border, health border, wave counter border, and weapon border onto the LCD. |
musallambseiso | 10:c5ef17e93872 | 27 | */ |
musallambseiso | 10:c5ef17e93872 | 28 | void draw_grid(N5110 &lcd); |
musallambseiso | 10:c5ef17e93872 | 29 | |
musallambseiso | 10:c5ef17e93872 | 30 | |
musallambseiso | 10:c5ef17e93872 | 31 | /** Draw Wave Counter |
musallambseiso | 10:c5ef17e93872 | 32 | * |
musallambseiso | 10:c5ef17e93872 | 33 | * Draws the wave counter onto the LCD. |
musallambseiso | 10:c5ef17e93872 | 34 | * @param wave_counter - counter that stores which wave the game is in |
musallambseiso | 10:c5ef17e93872 | 35 | */ |
musallambseiso | 10:c5ef17e93872 | 36 | void draw_wave_counter(N5110 &lcd, int wave_counter); |
musallambseiso | 10:c5ef17e93872 | 37 | |
musallambseiso | 10:c5ef17e93872 | 38 | |
musallambseiso | 10:c5ef17e93872 | 39 | /** Draw Health |
musallambseiso | 10:c5ef17e93872 | 40 | * |
musallambseiso | 10:c5ef17e93872 | 41 | * Draws the outside border of the health bar heart onto the LCD. |
musallambseiso | 10:c5ef17e93872 | 42 | */ |
musallambseiso | 7:cae9a95427f7 | 43 | void draw_health(N5110 &lcd); |
musallambseiso | 10:c5ef17e93872 | 44 | |
musallambseiso | 10:c5ef17e93872 | 45 | |
musallambseiso | 10:c5ef17e93872 | 46 | /** Draw First Rocket |
musallambseiso | 10:c5ef17e93872 | 47 | * |
musallambseiso | 10:c5ef17e93872 | 48 | * Draws the first rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted |
musallambseiso | 10:c5ef17e93872 | 49 | * depending on the "state" variable. Further explained in the "check_rocket" method. |
musallambseiso | 10:c5ef17e93872 | 50 | * @param state - variable that determines if line is drawn full black (1) or dotted (2) |
musallambseiso | 10:c5ef17e93872 | 51 | */ |
musallambseiso | 9:b9ad5e45aebf | 52 | void draw_rocket1(N5110 &lcd, int state); |
musallambseiso | 10:c5ef17e93872 | 53 | |
musallambseiso | 10:c5ef17e93872 | 54 | |
musallambseiso | 10:c5ef17e93872 | 55 | /** Draw Second Rocket |
musallambseiso | 10:c5ef17e93872 | 56 | * |
musallambseiso | 10:c5ef17e93872 | 57 | * Draws the second rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted |
musallambseiso | 10:c5ef17e93872 | 58 | * depending on the "state" variable. Further explained in the "check_rocket" method. |
musallambseiso | 10:c5ef17e93872 | 59 | * @param state - variable that determines if line is drawn full black (1) or dotted (2) |
musallambseiso | 10:c5ef17e93872 | 60 | */ |
musallambseiso | 9:b9ad5e45aebf | 61 | void draw_rocket2(N5110 &lcd, int state); |
musallambseiso | 10:c5ef17e93872 | 62 | |
musallambseiso | 10:c5ef17e93872 | 63 | |
musallambseiso | 10:c5ef17e93872 | 64 | /** Draw Third Rocket |
musallambseiso | 10:c5ef17e93872 | 65 | * |
musallambseiso | 10:c5ef17e93872 | 66 | * Draws the third rocket from the left in the weapons bar onto the LCD. It is drawn full black or dotted |
musallambseiso | 10:c5ef17e93872 | 67 | * depending on the "state" variable. Further explained in the "check_rocket" method. |
musallambseiso | 10:c5ef17e93872 | 68 | * @param state - variable that determines if line is drawn full black (1) or dotted (2) |
musallambseiso | 10:c5ef17e93872 | 69 | */ |
musallambseiso | 9:b9ad5e45aebf | 70 | void draw_rocket3(N5110 &lcd, int state); |
musallambseiso | 10:c5ef17e93872 | 71 | |
musallambseiso | 10:c5ef17e93872 | 72 | |
musallambseiso | 10:c5ef17e93872 | 73 | /** Draw Star |
musallambseiso | 10:c5ef17e93872 | 74 | * |
musallambseiso | 10:c5ef17e93872 | 75 | * Draws the star onto the LCD. It is drawn full black or dotted depending on the "state" variable. |
musallambseiso | 10:c5ef17e93872 | 76 | * Further explained in the "check_rocket" method. |
musallambseiso | 10:c5ef17e93872 | 77 | * @param state - variable that determines if line is drawn full black (1) or dotted (2) |
musallambseiso | 10:c5ef17e93872 | 78 | */ |
musallambseiso | 10:c5ef17e93872 | 79 | void draw_star (N5110 &lcd, int state); |
musallambseiso | 10:c5ef17e93872 | 80 | |
musallambseiso | 10:c5ef17e93872 | 81 | |
musallambseiso | 10:c5ef17e93872 | 82 | /** Check Health |
musallambseiso | 10:c5ef17e93872 | 83 | * |
musallambseiso | 10:c5ef17e93872 | 84 | * Draws the health bars onto the LCD depending on how much health the player has (depending on the variable "collisons"). |
musallambseiso | 10:c5ef17e93872 | 85 | * If zero collisions, health bar is full, i.e the heart is filled black. As collisions increase, the health bar |
musallambseiso | 10:c5ef17e93872 | 86 | * goes down, i.e less of the heart is filled black. |
musallambseiso | 10:c5ef17e93872 | 87 | * @param collisions - variable that stores how many collisions have been registered |
musallambseiso | 10:c5ef17e93872 | 88 | */ |
musallambseiso | 10:c5ef17e93872 | 89 | void check_health(N5110 &lcd, int collisions); |
musallambseiso | 10:c5ef17e93872 | 90 | |
musallambseiso | 10:c5ef17e93872 | 91 | |
musallambseiso | 10:c5ef17e93872 | 92 | /** Check Rocket |
musallambseiso | 10:c5ef17e93872 | 93 | * |
musallambseiso | 10:c5ef17e93872 | 94 | * Draws the rockets in the weapons bar onto the LCD depending on how many the player has (depending on the variable |
musallambseiso | 10:c5ef17e93872 | 95 | * "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), |
musallambseiso | 10:c5ef17e93872 | 96 | * 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, |
musallambseiso | 10:c5ef17e93872 | 97 | * and the third one is drawn with a state of 2, etc. |
musallambseiso | 10:c5ef17e93872 | 98 | * @param ammo - variable that stores how many rockets are available |
musallambseiso | 10:c5ef17e93872 | 99 | */ |
musallambseiso | 9:b9ad5e45aebf | 100 | void check_rocket(N5110 &lcd, int ammo); |
musallambseiso | 10:c5ef17e93872 | 101 | |
musallambseiso | 10:c5ef17e93872 | 102 | |
musallambseiso | 10:c5ef17e93872 | 103 | /** Check Star |
musallambseiso | 10:c5ef17e93872 | 104 | * |
musallambseiso | 10:c5ef17e93872 | 105 | * Draws the star in the weapons bar onto the LCD depending on if the player has one available (depending on the variable |
musallambseiso | 10:c5ef17e93872 | 106 | * "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 |
musallambseiso | 10:c5ef17e93872 | 107 | * is drawn dotted, i.e drawn with the state set to 2. |
musallambseiso | 10:c5ef17e93872 | 108 | * @param star - variable that stores whether a star is available or not |
musallambseiso | 10:c5ef17e93872 | 109 | */ |
musallambseiso | 10:c5ef17e93872 | 110 | void check_star(N5110 &lcd, bool star); |
musallambseiso | 5:b822aaa6200d | 111 | |
musallambseiso | 5:b822aaa6200d | 112 | private: |
musallambseiso | 7:cae9a95427f7 | 113 | |
musallambseiso | 5:b822aaa6200d | 114 | }; |
musallambseiso | 6:fb678d095e0a | 115 | |
musallambseiso | 5:b822aaa6200d | 116 | #endif |