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@42:ee13e1d103d8, 2019-05-08 (annotated)
- Committer:
- ikenna1
- Date:
- Wed May 08 11:18:40 2019 +0000
- Revision:
- 42:ee13e1d103d8
- Parent:
- 40:90c7a893d513
Change the way Lcd and Gamepad libraries are accessed for ease of documentation
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 | 42:ee13e1d103d8 | 17 | void init(int ship_xpos, int ship_ypos, int ship_width,N5110 *lcd, Gamepad *pad); |
ikenna1 | 9:241a1a7d8527 | 18 | |
ikenna1 | 9:241a1a7d8527 | 19 | /* Draw the missle */ |
ikenna1 | 42:ee13e1d103d8 | 20 | void draw(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 | 42:ee13e1d103d8 | 39 | Gamepad *_pad; |
ikenna1 | 42:ee13e1d103d8 | 40 | N5110 *_lcd; |
ikenna1 | 42:ee13e1d103d8 | 41 | |
ikenna1 | 40:90c7a893d513 | 42 | Enemy _enemy; |
ikenna1 | 9:241a1a7d8527 | 43 | int reset; |
ikenna1 | 9:241a1a7d8527 | 44 | Vector2D _velocity; |
ikenna1 | 9:241a1a7d8527 | 45 | int _size; |
ikenna1 | 9:241a1a7d8527 | 46 | int _x; |
ikenna1 | 9:241a1a7d8527 | 47 | int _y; |
ikenna1 | 9:241a1a7d8527 | 48 | |
ikenna1 | 9:241a1a7d8527 | 49 | }; |
ikenna1 | 9:241a1a7d8527 | 50 | #endif |