JianWei Lee
/
project_game
Meteor defense project
Diff: GameEngine/GameEngine.cpp
- Revision:
- 17:53aedd20155a
- Parent:
- 16:ddc4d5669a6e
- Child:
- 18:d82059ce929b
diff -r ddc4d5669a6e -r 53aedd20155a GameEngine/GameEngine.cpp --- a/GameEngine/GameEngine.cpp Fri Apr 07 10:49:57 2017 +0000 +++ b/GameEngine/GameEngine.cpp Mon Apr 10 09:56:47 2017 +0000 @@ -9,7 +9,18 @@ { } - +void GameEngine::init() { + _d1.droneInit(20, 46, 0); + _d2.droneInit(62, 46, 83); + weap.shieldInit(); +} +void GameEngine::update(Gamepad &pad, N5110 &lcd) { + _d1.drone(Array1, charArray, lcd); + _d2.drone(Array1, charArray, lcd); + drawSpawn(lcd); + drawLaserPlayer(pad, lcd); + bombAndShield(pad, lcd); +} void GameEngine::drawSpawn(N5110 &lcd){ //spawning every 2 second, moving every 1 seconds at 15 fps & drawit=15. //It changes depending on the game FPS. @@ -48,9 +59,8 @@ } } } -void GameEngine::bombAndShield(Gamepad &pad, N5110 &lcd) { //cooldown not yet implemented. +void GameEngine::bombAndShield(Gamepad &pad, N5110 &lcd) { weap.bombCooldown(Array1, pad, lcd); - weap.shieldInit(); //only need to run once. if (pad.check_event(Gamepad::X_PRESSED)) { //to prevent from detonating the bomb at instant when button X is accidentally pressed }