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
Diff: main.cpp
- Revision:
- 16:37d98c281eb3
- Parent:
- 15:a080c64cf301
- Child:
- 17:ce6b54422113
--- a/main.cpp Mon May 06 18:39:40 2019 +0000
+++ b/main.cpp Wed May 08 09:05:27 2019 +0000
@@ -14,31 +14,31 @@
Gamepad pad;
Smiley smiley;
Coin coin;
+Enemy1 enemy1;
+Menu menu;
void init();
void render();
-void start_screen();
-void pause_screen();
+void startScreen();
int main(){
-
+
int fps = 30;
+ int lives = 0;
+
+ lcd.setContrast(0.4);
+ lcd.setBrightness(0.5);
init();
- start_screen();
+ game.death(lives);
+ startScreen();
+ game.UI(pad,lcd);
render();
wait(1.0f/fps);
while (1) {
- if (pad.check_event(Gamepad::BACK_PRESSED) == true){
- pause_screen();
- wait(1);
- } else {
- render();
- game.dirmag(pad);
- game.movement(pad,lcd);
- wait(1.0f/fps);
- }
- }
+ render();
+ wait(1.0f/fps);
+ }
}
void init(){
@@ -49,35 +49,25 @@
void render(){
lcd.clear();
+ game.dirmag(pad);
game.drawSprite(lcd);
- game.collect(smiley,coin,lcd);
+ game.movement(pad,lcd);
+ game.collect(lcd, pad);
+ game.damage(lcd,pad);
lcd.refresh();
}
-
-void start_screen(){
- lcd.printString("PAUSED",42,24);
- lcd.refresh();
-
- while ( pad.check_event(Gamepad::START_PRESSED) == false) {
+
+void startScreen(){
+ while (pad.check_event(Gamepad::START_PRESSED) == false) {
lcd.clear();
lcd.drawSprite(0,0,48,84,(int *)start_01);
- wait(1);
+ lcd.refresh();
+ wait(0.5);
lcd.drawSprite(0,0,48,84,(int *)start_02);
- wait(1);
- lcd.drawSprite(0,0,48,84,(int *)start_02);
- wait(1);
lcd.refresh();
+ wait(0.5);
+ lcd.drawSprite(0,0,48,84,(int *)start_03);
+ lcd.refresh();
+ wait(0.5);
}
-}
-
-void pause_screen(){
- lcd.printString("PAUSED",42,24);
- lcd.refresh();
-
- while (pad.check_event(Gamepad::BACK_PRESSED) == true) {
- pad.leds_on();
- wait(0.1);
- pad.leds_off();
- wait(0.1);
- }
-}
+}
\ No newline at end of file