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
Ship/Ship.h@26:31a729ec7e76, 2020-05-15 (annotated)
- Committer:
- josh_ohara
- Date:
- Fri May 15 15:49:43 2020 +0000
- Revision:
- 26:31a729ec7e76
- Parent:
- 25:823b1a997a0c
- Child:
- 27:eb755a345b1f
ireelevant commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| josh_ohara | 8:86cb9a9f8a73 | 1 | #ifndef SHIP_H |
| josh_ohara | 8:86cb9a9f8a73 | 2 | #define SHIP_H |
| josh_ohara | 2:c2316b659b97 | 3 | |
| josh_ohara | 3:8a140aa1ddcd | 4 | #include "mbed.h" |
| josh_ohara | 3:8a140aa1ddcd | 5 | #include "N5110.h" |
| josh_ohara | 3:8a140aa1ddcd | 6 | #include "Gamepad.h" |
| josh_ohara | 21:970807533b10 | 7 | #include "BulletS.h" |
| josh_ohara | 2:c2316b659b97 | 8 | |
| josh_ohara | 25:823b1a997a0c | 9 | /** Ship Class |
| josh_ohara | 25:823b1a997a0c | 10 | @author Joshua Ohara, el18jkeo, 201291390 |
| josh_ohara | 25:823b1a997a0c | 11 | @brief Controls the ship |
| josh_ohara | 25:823b1a997a0c | 12 | @date May 2020 |
| josh_ohara | 25:823b1a997a0c | 13 | */ |
| josh_ohara | 25:823b1a997a0c | 14 | |
| josh_ohara | 2:c2316b659b97 | 15 | class Ship |
| josh_ohara | 2:c2316b659b97 | 16 | { |
| josh_ohara | 2:c2316b659b97 | 17 | |
| josh_ohara | 2:c2316b659b97 | 18 | public: |
| josh_ohara | 8:86cb9a9f8a73 | 19 | Ship(); |
| josh_ohara | 8:86cb9a9f8a73 | 20 | ~Ship(); |
| josh_ohara | 8:86cb9a9f8a73 | 21 | void init(int height, int width); //dimensions of the ship without shooter, y position is bottom of the screen |
| josh_ohara | 8:86cb9a9f8a73 | 22 | void render(N5110 &lcd); //Draws basic rectangle ship |
| josh_ohara | 6:5bea67cc96f9 | 23 | Vector2D get_position(); //Returns position of ship |
| josh_ohara | 21:970807533b10 | 24 | void update(Direction d, float mag, Gamepad &pad, N5110 &lcd, int counter); //Interface between joystick and ship control |
| josh_ohara | 3:8a140aa1ddcd | 25 | int get_height(); |
| josh_ohara | 3:8a140aa1ddcd | 26 | int get_width(); |
| josh_ohara | 20:0b6f1cfc5be6 | 27 | void set_life(bool life); |
| josh_ohara | 21:970807533b10 | 28 | bool get_life(); |
| josh_ohara | 21:970807533b10 | 29 | vector<Bullet> get_bullet_vector(); |
| josh_ohara | 21:970807533b10 | 30 | void set_bullet_hit(int i, bool hit); |
| josh_ohara | 2:c2316b659b97 | 31 | |
| josh_ohara | 2:c2316b659b97 | 32 | private: |
| josh_ohara | 2:c2316b659b97 | 33 | int Height; |
| josh_ohara | 2:c2316b659b97 | 34 | int Width; |
| josh_ohara | 2:c2316b659b97 | 35 | int X; |
| josh_ohara | 25:823b1a997a0c | 36 | int Y; |
| josh_ohara | 25:823b1a997a0c | 37 | int Speed; |
| josh_ohara | 20:0b6f1cfc5be6 | 38 | bool Life; |
| josh_ohara | 21:970807533b10 | 39 | BulletS ship_bullet_vector; |
| josh_ohara | 2:c2316b659b97 | 40 | }; |
| josh_ohara | 8:86cb9a9f8a73 | 41 | |
| josh_ohara | 8:86cb9a9f8a73 | 42 | #endif |