A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
Diff: main.cpp
- Revision:
- 26:abbc19edc5c1
- Parent:
- 25:112cbcb0b4a7
- Child:
- 27:a1b41626f57c
--- a/main.cpp Fri Apr 26 02:38:05 2019 +0000 +++ b/main.cpp Mon Apr 29 02:45:17 2019 +0000 @@ -21,8 +21,6 @@ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; -int counter = 0; - bool entity_collision(Entity &a, Entity &b) // returns true if the two entity hitboxes collide { if (((b.get_pos_x() <= a.get_pos_x()) && (a.get_pos_x() <= b.get_pos_x() + b.get_hitbox_width() - 1)) || @@ -75,6 +73,7 @@ int main() { + // initialize lcd.init(); lcd.setContrast(0.45); gamepad.init(); @@ -167,7 +166,13 @@ // Entity Collision Detection // MiniMap Screen Detection - + if(gamepad.check_event(Gamepad::BACK_PRESSED)) { + wait(0.05); + lcd.clear(); + while(gamepad.check_event(Gamepad::BACK_PRESSED)) { + }; + }; + // Pause Detection if(gamepad.check_event(Gamepad::START_PRESSED)) { lcd.drawSpriteTransparent(0, @@ -251,8 +256,6 @@ } lcd.refresh(); wait_ms(1000/40); // setting FPS - counter++; - } gameover: { lcd.clear(); @@ -273,4 +276,10 @@ } } } +} + +void render(){ + lcd.clear(); + lcd.refresh(); + wait_ms(1000/40); // setting FPS } \ No newline at end of file