Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
Diff: UFO/UFO.cpp
- Revision:
- 8:b4a2954dd74f
- Parent:
- 6:cbd9e1f26a10
--- a/UFO/UFO.cpp Fri May 15 22:23:22 2020 +0000 +++ b/UFO/UFO.cpp Sat May 16 17:26:10 2020 +0000 @@ -9,11 +9,11 @@ } -void UFO::init(int width,int height, int speed){ +void UFO::init(int sizeX,int sizeY){ - _width = width; - _height = height; // define the size of UFO - _x = rand() % (84- _width); + _sizeX = sizeX; + _sizeY = sizeY; + _x = rand() % (84- _sizeX); _y = 0; _speed=2; } @@ -33,14 +33,14 @@ void UFO::draw(N5110 &lcd) { //different ufo shapes for each level - int UFO[5][12] = { + int UFO[60] = { 1,1,1,1,1,1,1,1,1,1,1,1 , 1,1,1,0,0,0,0,0,0,1,1,1 , 1,1,1,0,0,0,0,0,0,1,1,1 , 1,1,1,0,0,0,0,0,0,1,1,1 , 1,1,1,1,1,1,1,1,1,1,1,1 }; - Bitmap sprite(enemy, _width, _height); + Bitmap sprite(UFO, _sizeX, _sizeY); sprite.render(lcd, _x, _y); } int UFO::getBlood(){