Meteor defense project

Dependencies:   N5110 mbed

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jasper0712 0:5fbc0fbc9d30 1 #include "mbed.h"
jasper0712 0:5fbc0fbc9d30 2 #include "N5110.h"
jasper0712 0:5fbc0fbc9d30 3 #include "Gamepad.h"
jasper0712 4:4145abd09075 4 #include "GameEngine.h"
jasper0712 0:5fbc0fbc9d30 5
jasper0712 0:5fbc0fbc9d30 6 #define PI 3.14159265
jasper0712 0:5fbc0fbc9d30 7 //Y rows and X columns
jasper0712 1:f5cda0674f24 8 #define Rows 48
jasper0712 1:f5cda0674f24 9 #define Cols 84
jasper0712 0:5fbc0fbc9d30 10
jasper0712 0:5fbc0fbc9d30 11 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
jasper0712 0:5fbc0fbc9d30 12 Gamepad pad;
jasper0712 4:4145abd09075 13 GameEngine game;
jasper0712 5:c74bbdda06f4 14
jasper0712 4:4145abd09075 15
jasper0712 0:5fbc0fbc9d30 16
jasper0712 8:9814b7261854 17 int gamefps = 15;
jasper0712 0:5fbc0fbc9d30 18 void init();
jasper0712 0:5fbc0fbc9d30 19 void render();
jasper0712 0:5fbc0fbc9d30 20
jasper0712 0:5fbc0fbc9d30 21 int main()
jasper0712 0:5fbc0fbc9d30 22 {
jasper0712 0:5fbc0fbc9d30 23
jasper0712 0:5fbc0fbc9d30 24 init();
jasper0712 0:5fbc0fbc9d30 25 while (true) {
jasper0712 4:4145abd09075 26 game.drawSpawn(lcd);
jasper0712 0:5fbc0fbc9d30 27
jasper0712 5:c74bbdda06f4 28 game.drawLaserPlayer(pad,lcd);
jasper0712 9:4c4d787c7a8b 29
jasper0712 0:5fbc0fbc9d30 30 render();
jasper0712 0:5fbc0fbc9d30 31 }
jasper0712 0:5fbc0fbc9d30 32 }
jasper0712 0:5fbc0fbc9d30 33
jasper0712 0:5fbc0fbc9d30 34 void init()
jasper0712 0:5fbc0fbc9d30 35 {
jasper0712 0:5fbc0fbc9d30 36 // need to initialise LCD and Gamepad
jasper0712 0:5fbc0fbc9d30 37 lcd.init();
jasper0712 0:5fbc0fbc9d30 38 pad.init();
jasper0712 0:5fbc0fbc9d30 39
jasper0712 0:5fbc0fbc9d30 40 // initialise the game
jasper0712 0:5fbc0fbc9d30 41 }
jasper0712 0:5fbc0fbc9d30 42
jasper0712 0:5fbc0fbc9d30 43 void render()
jasper0712 0:5fbc0fbc9d30 44 {
jasper0712 0:5fbc0fbc9d30 45 // clear screen, re-draw and refresh
jasper0712 0:5fbc0fbc9d30 46 lcd.refresh();
jasper0712 0:5fbc0fbc9d30 47 wait(1.0/gamefps);
jasper0712 0:5fbc0fbc9d30 48 lcd.clear();
jasper0712 0:5fbc0fbc9d30 49 }