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@40:90c7a893d513, 2019-05-07 (annotated)
- Committer:
- ikenna1
- Date:
- Tue May 07 10:01:34 2019 +0000
- Revision:
- 40:90c7a893d513
- Parent:
- 26:a53d41adf40b
- Child:
- 42:ee13e1d103d8
- Child:
- 43:500b8cff3715
Add Orion ship weapons ; Gives a weapon that tracks the movements of enemy ship to the Orion
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 | 40:90c7a893d513 | 8 | #include "Enemy.h" |
ikenna1 | 9:241a1a7d8527 | 9 | |
ikenna1 | 9:241a1a7d8527 | 10 | class Weapons |
ikenna1 | 9:241a1a7d8527 | 11 | { |
ikenna1 | 9:241a1a7d8527 | 12 | public: |
ikenna1 | 9:241a1a7d8527 | 13 | Weapons(); |
ikenna1 | 9:241a1a7d8527 | 14 | ~Weapons(); |
ikenna1 | 9:241a1a7d8527 | 15 | |
ikenna1 | 9:241a1a7d8527 | 16 | /* Initialize the class with the ship position */ |
ikenna1 | 9:241a1a7d8527 | 17 | void init(int ship_xpos, int ship_ypos, int ship_width); |
ikenna1 | 9:241a1a7d8527 | 18 | |
ikenna1 | 9:241a1a7d8527 | 19 | /* Draw the missle */ |
ikenna1 | 40:90c7a893d513 | 20 | void draw(N5110 &lcd,Gamepad &pad,int shipno,Vector2D closest); |
ikenna1 | 9:241a1a7d8527 | 21 | |
ikenna1 | 9:241a1a7d8527 | 22 | /* Gets the projectiles position */ |
ikenna1 | 24:ab821bfeb383 | 23 | Vector2D get_pos(int shipno); |
ikenna1 | 9:241a1a7d8527 | 24 | |
ikenna1 | 9:241a1a7d8527 | 25 | /* Moves the projectile across the screen */ |
ikenna1 | 9:241a1a7d8527 | 26 | void update(); |
ikenna1 | 9:241a1a7d8527 | 27 | int ship_xpos; |
ikenna1 | 9:241a1a7d8527 | 28 | int ship_ypos; |
ikenna1 | 9:241a1a7d8527 | 29 | int _ship_xpos; |
ikenna1 | 9:241a1a7d8527 | 30 | int _ship_ypos; |
ikenna1 | 9:241a1a7d8527 | 31 | |
ikenna1 | 9:241a1a7d8527 | 32 | /** Set Position |
ikenna1 | 9:241a1a7d8527 | 33 | * |
ikenna1 | 9:241a1a7d8527 | 34 | * This function is used to set the position of the projectile to a specific coordinate on screen. |
ikenna1 | 9:241a1a7d8527 | 35 | */ |
ikenna1 | 26:a53d41adf40b | 36 | void set_pos(int xpos, int ypos); |
ikenna1 | 9:241a1a7d8527 | 37 | |
ikenna1 | 9:241a1a7d8527 | 38 | private: |
ikenna1 | 40:90c7a893d513 | 39 | Enemy _enemy; |
ikenna1 | 9:241a1a7d8527 | 40 | int reset; |
ikenna1 | 9:241a1a7d8527 | 41 | Vector2D _velocity; |
ikenna1 | 9:241a1a7d8527 | 42 | int _size; |
ikenna1 | 9:241a1a7d8527 | 43 | int _x; |
ikenna1 | 9:241a1a7d8527 | 44 | int _y; |
ikenna1 | 9:241a1a7d8527 | 45 | |
ikenna1 | 9:241a1a7d8527 | 46 | }; |
ikenna1 | 9:241a1a7d8527 | 47 | #endif |