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 139:c46a2cef7e09, committed 2019-05-09
- Comitter:
- fy14lkaa
- Date:
- Thu May 09 05:50:57 2019 +0000
- Parent:
- 138:66befaefb27e
- Child:
- 140:e389918735a7
- Commit message:
- adding printf statement.
Changed in this revision
| Alien/Alien.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Spaceship/Spaceship.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Alien/Alien.cpp Thu May 09 05:42:22 2019 +0000
+++ b/Alien/Alien.cpp Thu May 09 05:50:57 2019 +0000
@@ -11,10 +11,10 @@
}
-//intialise the prameters of class Alien
+
void Alien::init(int x_alien,int y_alien, int speed_alien)
{
-
+ //intialise the prameters of class Alien
_x_alien = x_alien; // the position of alien at x-cooridante.
_y_alien = y_alien; // the position of alien at y-cooridante.
_speed_alien = speed_alien; // the speed of the alien.
--- a/Spaceship/Spaceship.cpp Thu May 09 05:42:22 2019 +0000
+++ b/Spaceship/Spaceship.cpp Thu May 09 05:50:57 2019 +0000
@@ -1,23 +1,26 @@
#include "Spaceship.h"
-Spaceship::Spaceship()
+Spaceship::Spaceship() //constructor of class Spaceship
{
}
-Spaceship::~Spaceship()
+Spaceship::~Spaceship() //Destructor of class Spaceship
{
}
void Spaceship::init(int x_spaceship,int y_spaceship, int speed_spaceship)
{
+ //intialise the prameters of class Spaceship
- _x_spaceship= x_spaceship;
- _y_spaceship= y_spaceship;
- _speed_spaceship= speed_spaceship;
+ _x_spaceship= x_spaceship; // the position of spaceship at x-cooridante.
+ _y_spaceship= y_spaceship; // the position of spaceship at y-cooridante.
+ _speed_spaceship= speed_spaceship; // the speed of the alien.
}
+
+ // void function to draw the spaceship by using N5110 library
void Spaceship::draw(N5110 &lcd)
{
-
+ . //drawing the spaceship by using lcd.drawSprite.
lcd.drawSprite(_x_spaceship,_y_spaceship,32,32,(int *) spaceship2);
}
@@ -28,8 +31,10 @@
_speed_spaceship = int(mag*10.0f);
if(d==N){
- // printf("North\n");
+
_y_spaceship-=2;
+
+ // printf("North\n");
}
else
if(d==S){