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
Diff: Ship/Ship.h
- Revision:
- 27:eb755a345b1f
- Parent:
- 26:31a729ec7e76
- Child:
- 35:517b56b010df
--- a/Ship/Ship.h Fri May 15 15:49:43 2020 +0000
+++ b/Ship/Ship.h Sat May 16 16:18:32 2020 +0000
@@ -18,25 +18,24 @@
public:
Ship();
~Ship();
- void init(int height, int width); //dimensions of the ship without shooter, y position is bottom of the screen
- void render(N5110 &lcd); //Draws basic rectangle ship
- Vector2D get_position(); //Returns position of ship
- void update(Direction d, float mag, Gamepad &pad, N5110 &lcd, int counter); //Interface between joystick and ship control
- int get_height();
- int get_width();
- void set_life(bool life);
- bool get_life();
- vector<Bullet> get_bullet_vector();
- void set_bullet_hit(int i, bool hit);
+ void init(int height, int width); //initialises ship object, sets private variables
+ void render(N5110 &lcd); //draws ship if alive
+ void update(Direction d, float mag, Gamepad &pad, N5110 &lcd, int counter); //updates the position and shooting of the ship
+ //accessors and mutators
+ void set_life(bool life); //sets the life of the ship
+ bool get_life(); //returns the life of the ship
+ void set_bullet_hit(int i, bool hit); //sets the life of a given ship bullet (hit if a collsion occurs)
+ Vector2D get_position(); //returns the position of the ship for collision check
+ vector<ShipBullet> get_bullet_vector(); //returns the ship bullet vector for collsion check
private:
- int Height;
- int Width;
- int X;
- int Y;
- int Speed;
- bool Life;
- BulletS ship_bullet_vector;
+ int _height; //height of the ship main rectangle
+ int _width; //width of the ship main rectangle
+ int _x; //x posittion of ship
+ int _y; //y position of the ship
+ int _speed; //speed of the ship in x direction
+ bool _life; //whether the ship is alive or not
+ BulletS _ship_bullet_vector; //object to create ship bullet vector
};
#endif
\ No newline at end of file