Meteor defense project

Dependencies:   N5110 mbed

Committer:
jasper0712
Date:
Tue Mar 28 20:13:01 2017 +0000
Revision:
9:4c4d787c7a8b
Parent:
7:3be4369131c6
Child:
10:926b1f89c4f1
laser damage implemented. starting on game rule

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jasper0712 4:4145abd09075 1 #include "GameEngine.h"
jasper0712 4:4145abd09075 2
jasper0712 4:4145abd09075 3 GameEngine::GameEngine()
jasper0712 4:4145abd09075 4 {
jasper0712 4:4145abd09075 5
jasper0712 4:4145abd09075 6 }
jasper0712 4:4145abd09075 7
jasper0712 4:4145abd09075 8 GameEngine::~GameEngine()
jasper0712 4:4145abd09075 9 {
jasper0712 4:4145abd09075 10
jasper0712 4:4145abd09075 11 }
jasper0712 4:4145abd09075 12
jasper0712 4:4145abd09075 13 void GameEngine::drawSpawn(N5110 &lcd){
jasper0712 9:4c4d787c7a8b 14 //spawning every 2 second, moving every 1 seconds at 15 fps & drawit=15.
jasper0712 9:4c4d787c7a8b 15 //It changes depending on the game FPS.
jasper0712 4:4145abd09075 16 if (drawit ==0) {
jasper0712 9:4c4d787c7a8b 17 drawit =20;
jasper0712 6:a554424e4517 18 spa.randomizeSpawn(Array1, Array2);
jasper0712 6:a554424e4517 19 spa.moveSpawn(Array1, Array2);
jasper0712 6:a554424e4517 20 spa.updateSpawn(Array1,Array2,lcd);
jasper0712 4:4145abd09075 21 } else {
jasper0712 4:4145abd09075 22 drawit -=0.5;
jasper0712 6:a554424e4517 23 spa.updateSpawn(Array1,Array2,lcd);
jasper0712 4:4145abd09075 24 }
jasper0712 4:4145abd09075 25 }
jasper0712 5:c74bbdda06f4 26 void GameEngine::drawLaserPlayer(Gamepad &pad, N5110 &lcd) {
jasper0712 9:4c4d787c7a8b 27 weap.laserDamage();
jasper0712 5:c74bbdda06f4 28 weap.drawWeapon(pad, lcd);
jasper0712 9:4c4d787c7a8b 29 //draw a line for the laser when button is pressed
jasper0712 5:c74bbdda06f4 30 if (pad.buttonhold == 1) {
jasper0712 7:3be4369131c6 31 //printf("hi, button is working \n");
jasper0712 5:c74bbdda06f4 32 weap.weaponMath(pad);
jasper0712 9:4c4d787c7a8b 33 weap.drawLaser(Array1, lcd);
jasper0712 5:c74bbdda06f4 34 }
jasper0712 5:c74bbdda06f4 35 }
jasper0712 9:4c4d787c7a8b 36
jasper0712 5:c74bbdda06f4 37 void GameEngine::checkGameRule() {
jasper0712 9:4c4d787c7a8b 38 //the only way to lose is when the spawn reaches y = 46.
jasper0712 5:c74bbdda06f4 39
jasper0712 5:c74bbdda06f4 40 }
jasper0712 9:4c4d787c7a8b 41
jasper0712 4:4145abd09075 42