Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Diff: Spaceship/Spaceship.cpp
- Revision:
- 139:c46a2cef7e09
- Parent:
- 138:66befaefb27e
- Child:
- 140:e389918735a7
--- 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){