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
Revision 106:73d5d818ae7d, committed 2019-05-05
- Comitter:
- fy14lkaa
- Date:
- Sun May 05 13:20:44 2019 +0000
- Parent:
- 105:b206078335a3
- Child:
- 107:83b0bc100600
- Commit message:
- change the class constructor and destructor and added a new void init function to include the new parameters as it has been modified.
Changed in this revision
| Spaceship/Spaceship.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Spaceship/Spaceship.cpp Sun May 05 13:17:31 2019 +0000
+++ b/Spaceship/Spaceship.cpp Sun May 05 13:20:44 2019 +0000
@@ -1,63 +1,20 @@
#include "Spaceship.h"
-Space_ship::Space_ship()
+Spaceship::Spaceship()
{
-
}
-
-Space_ship::~Space_ship()
+Spaceship::~Spaceship()
{
-
}
-
-const int Space_ship[10][12]= {
- {0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,1,1,0,0,0,0,0,0,0},
- {0,0,0,1,1,0,0,0,0,0,0,0},
- {0,1,1,1,1,1,1,1,0,0,0,0},
- {0,1,1,1,1,1,1,1,1,0,0,0},
- {0,1,1,1,1,1,1,1,1,1,1,0},
- {0,1,1,1,1,1,1,1,1,0,0,0},
- {0,1,1,1,1,1,1,1,0,0,0,0},
- {0,0,0,1,1,0,0,0,0,0,0,0},
- {0,0,0,1,1,0,0,0,0,0,0,0},
-
-};
-
-void Space_ship::init(int x,int height,int width)
+void Spaceship::init(int x_spaceship,int y_spaceship, int speed_spaceship)
{
- _x = x; // x value on screen is fixed
- _y = HEIGHT/2 - height/2; // y depends on height of screen and height of Space_ship
- _height = height;
- _width = width;
- _speed = 1; // default speed
- _score = 0; // start score from zero
+
+ _x_spaceship= x_spaceship;
+ _y_spaceship= y_spaceship;
+ _speed_spaceship= speed_spaceship;
+}
-
-}
-
-void Space_ship::draw(N5110 &lcd)
-{
- // draw Space_ship in screen buffer.
- lcd.drawSprite(x_Space_ship,y_Space_ship,10,12,(int *) Space_ship);
-}
-
-void Space_ship::add_score()
-{
- _score++;
-}
-
-int Space_ship::get_score()
-{
- return _score;
-}
-
-Vector2D Space_ship::get_pos()
-{
- Vector2D p = {_x,_y};
- return p;
-}
\ No newline at end of file