Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Weapons/Weapons.h@9:241a1a7d8527, 2019-04-09 (annotated)
- Committer:
- ikenna1
- Date:
- Tue Apr 09 05:14:07 2019 +0000
- Revision:
- 9:241a1a7d8527
- Child:
- 14:88ca5b1a111a
Had to work on this in another folder as this one got corrupted for some reason but it works once the name is changed so will work on it with name changed. New features include Menu class and Weapons class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ikenna1 | 9:241a1a7d8527 | 1 | #ifndef WEAPONS_H |
ikenna1 | 9:241a1a7d8527 | 2 | #define WEAPONS_H |
ikenna1 | 9:241a1a7d8527 | 3 | |
ikenna1 | 9:241a1a7d8527 | 4 | #include "mbed.h" |
ikenna1 | 9:241a1a7d8527 | 5 | #include "N5110.h" |
ikenna1 | 9:241a1a7d8527 | 6 | #include "Gamepad.h" |
ikenna1 | 9:241a1a7d8527 | 7 | #include "Ship.h" |
ikenna1 | 9:241a1a7d8527 | 8 | |
ikenna1 | 9:241a1a7d8527 | 9 | class Weapons |
ikenna1 | 9:241a1a7d8527 | 10 | { |
ikenna1 | 9:241a1a7d8527 | 11 | public: |
ikenna1 | 9:241a1a7d8527 | 12 | Weapons(); |
ikenna1 | 9:241a1a7d8527 | 13 | ~Weapons(); |
ikenna1 | 9:241a1a7d8527 | 14 | |
ikenna1 | 9:241a1a7d8527 | 15 | /* Initialize the class with the ship position */ |
ikenna1 | 9:241a1a7d8527 | 16 | void init(int ship_xpos, int ship_ypos, int ship_width); |
ikenna1 | 9:241a1a7d8527 | 17 | |
ikenna1 | 9:241a1a7d8527 | 18 | /* Draw the missle */ |
ikenna1 | 9:241a1a7d8527 | 19 | void draw(N5110 &lcd); |
ikenna1 | 9:241a1a7d8527 | 20 | |
ikenna1 | 9:241a1a7d8527 | 21 | /* Gets the projectiles position */ |
ikenna1 | 9:241a1a7d8527 | 22 | Vector2D get_pos(); |
ikenna1 | 9:241a1a7d8527 | 23 | |
ikenna1 | 9:241a1a7d8527 | 24 | /* Moves the projectile across the screen */ |
ikenna1 | 9:241a1a7d8527 | 25 | void update(); |
ikenna1 | 9:241a1a7d8527 | 26 | int ship_xpos; |
ikenna1 | 9:241a1a7d8527 | 27 | int ship_ypos; |
ikenna1 | 9:241a1a7d8527 | 28 | int _ship_xpos; |
ikenna1 | 9:241a1a7d8527 | 29 | int _ship_ypos; |
ikenna1 | 9:241a1a7d8527 | 30 | |
ikenna1 | 9:241a1a7d8527 | 31 | /** Set Position |
ikenna1 | 9:241a1a7d8527 | 32 | * |
ikenna1 | 9:241a1a7d8527 | 33 | * This function is used to set the position of the projectile to a specific coordinate on screen. |
ikenna1 | 9:241a1a7d8527 | 34 | */ |
ikenna1 | 9:241a1a7d8527 | 35 | void set_pos(Vector2D p); |
ikenna1 | 9:241a1a7d8527 | 36 | |
ikenna1 | 9:241a1a7d8527 | 37 | private: |
ikenna1 | 9:241a1a7d8527 | 38 | int reset; |
ikenna1 | 9:241a1a7d8527 | 39 | Vector2D _velocity; |
ikenna1 | 9:241a1a7d8527 | 40 | int _size; |
ikenna1 | 9:241a1a7d8527 | 41 | int _x; |
ikenna1 | 9:241a1a7d8527 | 42 | int _y; |
ikenna1 | 9:241a1a7d8527 | 43 | |
ikenna1 | 9:241a1a7d8527 | 44 | }; |
ikenna1 | 9:241a1a7d8527 | 45 | #endif |