This is the description

Dependencies:   mbed Menu Joystick

Committer:
mrkang
Date:
Mon Apr 27 14:04:30 2020 +0000
Revision:
0:59cbc5800eb6
Starwars

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mrkang 0:59cbc5800eb6 1 #include "Plane.h"
mrkang 0:59cbc5800eb6 2 Plane::Plane()
mrkang 0:59cbc5800eb6 3 {
mrkang 0:59cbc5800eb6 4
mrkang 0:59cbc5800eb6 5 }
mrkang 0:59cbc5800eb6 6 Plane::~Plane()
mrkang 0:59cbc5800eb6 7 {
mrkang 0:59cbc5800eb6 8
mrkang 0:59cbc5800eb6 9 }
mrkang 0:59cbc5800eb6 10 void Plane::init(int x,int y,int sizeX,int sizeY)
mrkang 0:59cbc5800eb6 11 {
mrkang 0:59cbc5800eb6 12 _x=x;
mrkang 0:59cbc5800eb6 13 _y=y;
mrkang 0:59cbc5800eb6 14 _sizeX = sizeX;
mrkang 0:59cbc5800eb6 15 _sizeY = sizeY;
mrkang 0:59cbc5800eb6 16 _speed = 4;
mrkang 0:59cbc5800eb6 17 }
mrkang 0:59cbc5800eb6 18 void Plane::draw(N5110 &lcd)
mrkang 0:59cbc5800eb6 19 {
mrkang 0:59cbc5800eb6 20 int _Plane[] = {
mrkang 0:59cbc5800eb6 21 0,0,0,0,1,0,0,0,0,0,
mrkang 0:59cbc5800eb6 22 0,0,0,1,1,1,0,0,0,0,
mrkang 0:59cbc5800eb6 23 0,0,0,1,0,1,0,0,0,0,
mrkang 0:59cbc5800eb6 24 0,0,0,1,1,1,0,0,0,0,
mrkang 0:59cbc5800eb6 25 0,0,1,1,1,1,1,0,0,0,
mrkang 0:59cbc5800eb6 26 0,1,1,1,1,1,1,1,0,0,
mrkang 0:59cbc5800eb6 27 1,1,1,1,1,1,1,1,1,0,
mrkang 0:59cbc5800eb6 28 0,0,0,1,1,1,0,0,0,0,
mrkang 0:59cbc5800eb6 29 0,0,0,1,0,1,0,0,0,0,
mrkang 0:59cbc5800eb6 30 0,0,0,1,0,1,0,0,0,0 };
mrkang 0:59cbc5800eb6 31
mrkang 0:59cbc5800eb6 32 Bitmap sprite(_Plane, _sizeX, _sizeY);
mrkang 0:59cbc5800eb6 33 sprite.render(lcd, _x, _y);
mrkang 0:59cbc5800eb6 34 }
mrkang 0:59cbc5800eb6 35 void Plane::update(int d)
mrkang 0:59cbc5800eb6 36 {
mrkang 0:59cbc5800eb6 37 if(d == 3){
mrkang 0:59cbc5800eb6 38 _x+=_speed;
mrkang 0:59cbc5800eb6 39 if(_x>75){
mrkang 0:59cbc5800eb6 40 _x = 75;
mrkang 0:59cbc5800eb6 41 }
mrkang 0:59cbc5800eb6 42 }else if(d == 7){
mrkang 0:59cbc5800eb6 43 _x=_speed;
mrkang 0:59cbc5800eb6 44 if(_x<0){
mrkang 0:59cbc5800eb6 45 _x = 0;
mrkang 0:59cbc5800eb6 46 }
mrkang 0:59cbc5800eb6 47 }
mrkang 0:59cbc5800eb6 48 }
mrkang 0:59cbc5800eb6 49 Vector2D Plane::getPos(){
mrkang 0:59cbc5800eb6 50 Vector2D p ={_x,_y};
mrkang 0:59cbc5800eb6 51 return p;
mrkang 0:59cbc5800eb6 52 }