Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 57:45c5de9cefdf
- Parent:
- 54:095eae44895b
- Child:
- 91:f9e2ff484014
--- a/main.cpp Fri Apr 26 01:09:46 2019 +0000 +++ b/main.cpp Sat Apr 27 15:48:20 2019 +0000 @@ -109,42 +109,42 @@ space.read_input(pad); space.update(pad); render(); - - } - Direction _d2 = pad.get_direction(); + } + + Direction _d2 = pad.get_direction(); - /*lcd.drawSprite(x_Alien,y_Alien,12,10,(int *)Alien); - lcd.drawSprite(x_bullet,y_bullet,4,10,(int *)bullet); - lcd.drawSprite(x_space_ship,y_space_ship,10,12,(int *) space_ship);*/ + /*lcd.drawSprite(x_Alien,y_Alien,12,10,(int *)Alien); + lcd.drawSprite(x_bullet,y_bullet,4,10,(int *)bullet); + lcd.drawSprite(x_space_ship,y_space_ship,10,12,(int *) space_ship);*/ - if (_d2==N) { - y=y-2; - } + if (_d2==N) { + y=y-2; + } - else if (_d2==E) { - bullet_fired=1; - x_bullet=11; - y_bullet=y; - } + else if (_d2==E) { + bullet_fired=1; + x_bullet=11; + y_bullet=y; + } - if (y>=40) { - y=40; - } + if (y>=40) { + y=40; + } - else if(y<=0) { - y =0; - } + else if(y<=0) { + y =0; + } - if(bullet_fired==1) { - x_bullet+=4; - } + if(bullet_fired==1) { + x_bullet+=4; + } - if(x_bullet>=x_Alien && y_bullet >=y_Alien && y_bullet <=y_Alien+10) { - y=0; - } + if(x_bullet>=x_Alien && y_bullet >=y_Alien && y_bullet <=y_Alien+10) { + y=0; + } - wait(1.0f/fps); + wait(1.0f/fps);