Helios Lyons
/
ELEC2645_Project_mc18hal
Helios Lyons 201239214
Canon/Canon.h@5:72f59786b695, 2020-04-14 (annotated)
- Committer:
- helioslyons
- Date:
- Tue Apr 14 13:22:35 2020 +0000
- Revision:
- 5:72f59786b695
- Parent:
- 4:c644522ff9d9
Import to Mbed Studio
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
helioslyons | 2:ef7f9892ba4f | 1 | #ifndef CANON_H |
helioslyons | 2:ef7f9892ba4f | 2 | #define CANON_H |
helioslyons | 2:ef7f9892ba4f | 3 | |
helioslyons | 2:ef7f9892ba4f | 4 | #include "mbed.h" |
helioslyons | 2:ef7f9892ba4f | 5 | #include "N5110.h" |
helioslyons | 2:ef7f9892ba4f | 6 | #include "Gamepad.h" |
helioslyons | 2:ef7f9892ba4f | 7 | |
helioslyons | 2:ef7f9892ba4f | 8 | /** Canon.h |
helioslyons | 2:ef7f9892ba4f | 9 | * @brief Defines variables and methods for the Canon. |
helioslyons | 2:ef7f9892ba4f | 10 | * @author Helios A. Lyons |
helioslyons | 2:ef7f9892ba4f | 11 | * @date April, 2020 |
helioslyons | 2:ef7f9892ba4f | 12 | */ |
helioslyons | 2:ef7f9892ba4f | 13 | |
helioslyons | 2:ef7f9892ba4f | 14 | class Canon |
helioslyons | 2:ef7f9892ba4f | 15 | { |
helioslyons | 2:ef7f9892ba4f | 16 | public: |
helioslyons | 2:ef7f9892ba4f | 17 | |
helioslyons | 2:ef7f9892ba4f | 18 | Canon(); |
helioslyons | 4:c644522ff9d9 | 19 | ~Canon(); // destructor |
helioslyons | 2:ef7f9892ba4f | 20 | |
helioslyons | 2:ef7f9892ba4f | 21 | void init(int x,int height,int width); |
helioslyons | 2:ef7f9892ba4f | 22 | void draw(N5110 &lcd); |
helioslyons | 2:ef7f9892ba4f | 23 | void update(Direction d,float mag); |
helioslyons | 2:ef7f9892ba4f | 24 | // int add_total_kills(); –– replaced by adding individual type kills |
helioslyons | 2:ef7f9892ba4f | 25 | |
helioslyons | 2:ef7f9892ba4f | 26 | /** Increment Invader 1 Kills |
helioslyons | 2:ef7f9892ba4f | 27 | * @param increase kills by 1 for Invader 1 |
helioslyons | 2:ef7f9892ba4f | 28 | */ |
helioslyons | 4:c644522ff9d9 | 29 | int add_inv1_kill(int n); // invader type 1 (first row) |
helioslyons | 2:ef7f9892ba4f | 30 | |
helioslyons | 2:ef7f9892ba4f | 31 | /** Increment Invader 2 Kills |
helioslyons | 2:ef7f9892ba4f | 32 | * @param increase kills by 1 for Invader 2 |
helioslyons | 2:ef7f9892ba4f | 33 | */ |
helioslyons | 4:c644522ff9d9 | 34 | int add_inv2_kill(int n); |
helioslyons | 2:ef7f9892ba4f | 35 | |
helioslyons | 2:ef7f9892ba4f | 36 | /** Increment Invader 3 Kills |
helioslyons | 2:ef7f9892ba4f | 37 | * @param increase kills by 1 for Invader 3 |
helioslyons | 2:ef7f9892ba4f | 38 | */ |
helioslyons | 4:c644522ff9d9 | 39 | int add_inv3_kill(int n); |
helioslyons | 2:ef7f9892ba4f | 40 | |
helioslyons | 2:ef7f9892ba4f | 41 | /** Increment Boss Kills |
helioslyons | 2:ef7f9892ba4f | 42 | * @param increase kills by 1 for Boss mobs |
helioslyons | 2:ef7f9892ba4f | 43 | */ |
helioslyons | 2:ef7f9892ba4f | 44 | int add_boss_kill(); // seperate for different boss levels? narrative structure? |
helioslyons | 2:ef7f9892ba4f | 45 | |
helioslyons | 2:ef7f9892ba4f | 46 | /** Get total kills |
helioslyons | 2:ef7f9892ba4f | 47 | * @return total kills by adding invader subtype kills |
helioslyons | 2:ef7f9892ba4f | 48 | */ |
helioslyons | 2:ef7f9892ba4f | 49 | int get_total_kill(); |
helioslyons | 2:ef7f9892ba4f | 50 | |
helioslyons | 2:ef7f9892ba4f | 51 | /** Get the score |
helioslyons | 2:ef7f9892ba4f | 52 | * @return current score based on current kills |
helioslyons | 2:ef7f9892ba4f | 53 | */ |
helioslyons | 2:ef7f9892ba4f | 54 | int get_score(); |
helioslyons | 2:ef7f9892ba4f | 55 | |
helioslyons | 2:ef7f9892ba4f | 56 | /** Get the position |
helioslyons | 2:ef7f9892ba4f | 57 | * @return current Canon position based on direction |
helioslyons | 2:ef7f9892ba4f | 58 | */ |
helioslyons | 2:ef7f9892ba4f | 59 | Vector2D get_pos(); |
helioslyons | 2:ef7f9892ba4f | 60 | |
helioslyons | 2:ef7f9892ba4f | 61 | /** Get remaining lives |
helioslyons | 2:ef7f9892ba4f | 62 | * @return current lives remaining |
helioslyons | 2:ef7f9892ba4f | 63 | */ |
helioslyons | 2:ef7f9892ba4f | 64 | int get_life(); |
helioslyons | 2:ef7f9892ba4f | 65 | |
helioslyons | 2:ef7f9892ba4f | 66 | /** Remove a life |
helioslyons | 2:ef7f9892ba4f | 67 | * @param decrease number of lives by 1 |
helioslyons | 2:ef7f9892ba4f | 68 | */ |
helioslyons | 2:ef7f9892ba4f | 69 | int remove_life(); |
helioslyons | 2:ef7f9892ba4f | 70 | |
helioslyons | 2:ef7f9892ba4f | 71 | /** Reset lives |
helioslyons | 2:ef7f9892ba4f | 72 | * @param reset lives to 3 |
helioslyons | 2:ef7f9892ba4f | 73 | */ |
helioslyons | 2:ef7f9892ba4f | 74 | int reset_life(); |
helioslyons | 2:ef7f9892ba4f | 75 | |
helioslyons | 2:ef7f9892ba4f | 76 | private: |
helioslyons | 2:ef7f9892ba4f | 77 | |
helioslyons | 2:ef7f9892ba4f | 78 | int _height; |
helioslyons | 2:ef7f9892ba4f | 79 | int _width; |
helioslyons | 2:ef7f9892ba4f | 80 | int _x; |
helioslyons | 2:ef7f9892ba4f | 81 | int _y; |
helioslyons | 2:ef7f9892ba4f | 82 | int _speed; |
helioslyons | 2:ef7f9892ba4f | 83 | int _score; |
helioslyons | 2:ef7f9892ba4f | 84 | int _inv1_kill; |
helioslyons | 2:ef7f9892ba4f | 85 | int _inv2_kill; |
helioslyons | 2:ef7f9892ba4f | 86 | int _inv3_kill; |
helioslyons | 2:ef7f9892ba4f | 87 | int _boss_kill; |
helioslyons | 2:ef7f9892ba4f | 88 | int _total_kill; |
helioslyons | 2:ef7f9892ba4f | 89 | int _life; |
helioslyons | 2:ef7f9892ba4f | 90 | |
helioslyons | 2:ef7f9892ba4f | 91 | }; |
helioslyons | 2:ef7f9892ba4f | 92 | #endif |