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@21:970807533b10, 2020-05-12 (annotated)
- Committer:
- josh_ohara
- Date:
- Tue May 12 15:33:50 2020 +0000
- Revision:
- 21:970807533b10
- Parent:
- 20:0b6f1cfc5be6
- Child:
- 25:823b1a997a0c
Alien ship and alien cover collisions programmed;
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 | 2:c2316b659b97 | 9 | class Ship |
| josh_ohara | 2:c2316b659b97 | 10 | { |
| josh_ohara | 2:c2316b659b97 | 11 | |
| josh_ohara | 2:c2316b659b97 | 12 | public: |
| josh_ohara | 8:86cb9a9f8a73 | 13 | Ship(); |
| josh_ohara | 8:86cb9a9f8a73 | 14 | ~Ship(); |
| josh_ohara | 8:86cb9a9f8a73 | 15 | void init(int height, int width); //dimensions of the ship without shooter, y position is bottom of the screen |
| josh_ohara | 8:86cb9a9f8a73 | 16 | void render(N5110 &lcd); //Draws basic rectangle ship |
| josh_ohara | 6:5bea67cc96f9 | 17 | Vector2D get_position(); //Returns position of ship |
| josh_ohara | 21:970807533b10 | 18 | void update(Direction d, float mag, Gamepad &pad, N5110 &lcd, int counter); //Interface between joystick and ship control |
| josh_ohara | 3:8a140aa1ddcd | 19 | int get_height(); |
| josh_ohara | 3:8a140aa1ddcd | 20 | int get_width(); |
| josh_ohara | 20:0b6f1cfc5be6 | 21 | void set_life(bool life); |
| josh_ohara | 21:970807533b10 | 22 | bool get_life(); |
| josh_ohara | 21:970807533b10 | 23 | vector<Bullet> get_bullet_vector(); |
| josh_ohara | 21:970807533b10 | 24 | void set_bullet_hit(int i, bool hit); |
| josh_ohara | 2:c2316b659b97 | 25 | |
| josh_ohara | 2:c2316b659b97 | 26 | private: |
| josh_ohara | 2:c2316b659b97 | 27 | int Height; |
| josh_ohara | 2:c2316b659b97 | 28 | int Width; |
| josh_ohara | 2:c2316b659b97 | 29 | int X; |
| josh_ohara | 6:5bea67cc96f9 | 30 | int Y; //y value of ship |
| josh_ohara | 6:5bea67cc96f9 | 31 | int Speed; //speed of ship |
| josh_ohara | 20:0b6f1cfc5be6 | 32 | bool Life; |
| josh_ohara | 21:970807533b10 | 33 | BulletS ship_bullet_vector; |
| josh_ohara | 2:c2316b659b97 | 34 | }; |
| josh_ohara | 8:86cb9a9f8a73 | 35 | |
| josh_ohara | 8:86cb9a9f8a73 | 36 | #endif |