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@24:ab821bfeb383, 2019-04-14 (annotated)
- Committer:
- ikenna1
- Date:
- Sun Apr 14 18:11:32 2019 +0000
- Revision:
- 24:ab821bfeb383
- Parent:
- 23:0301effce801
- Child:
- 26:a53d41adf40b
added imperion lazer - seeker collision
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 | 23:0301effce801 | 19 | void draw(N5110 &lcd,Gamepad &pad, int shipno); |
ikenna1 | 9:241a1a7d8527 | 20 | |
ikenna1 | 9:241a1a7d8527 | 21 | /* Gets the projectiles position */ |
ikenna1 | 24:ab821bfeb383 | 22 | Vector2D get_pos(int shipno); |
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 |