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.
Diff: myShip/spaceship.cpp
- Revision:
- 5:e3a9f0548922
- Parent:
- 3:cf9fead9c3f4
- Child:
- 6:cbd9e1f26a10
--- a/myShip/spaceship.cpp Fri May 15 01:25:16 2020 +0000 +++ b/myShip/spaceship.cpp Fri May 15 19:57:40 2020 +0000 @@ -65,7 +65,39 @@ control = true; //Prepare for next move //Input from user received -Vector2D Spaceship::getPos(){ +// get the position of the spaceship +Vector2D Spaceship::get_pos() +{ Vector2D p = {_x,_y}; return p; +} +// set the position of the spaceship +void Spaceship::set_pos(Vector2D p) +{ + _x = p.x; + _y = p.y; +} + +// add score when pass pillars +void Spaceship::add_score() +{ + _score++; +} + +// get score +int Spaceship::get_score() +{ + return _score; +} + +// the life of the spaceship +void Spaceship::set_life() +{ + _life++; +} + +// get life +int Spaceship::get_life() +{ + return _life; } \ No newline at end of file