Meteor defense project

Dependencies:   N5110 mbed

Committer:
jasper0712
Date:
Tue Apr 18 21:50:14 2017 +0000
Revision:
30:2e2d48cbfec3
Parent:
25:edd6a95607b1
Child:
31:1c0e47931e84
disastrous bug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jasper0712 1:f5cda0674f24 1 #ifndef SPAWN_H
jasper0712 1:f5cda0674f24 2 #define SPAWN_H
jasper0712 1:f5cda0674f24 3
jasper0712 1:f5cda0674f24 4 #include "mbed.h"
jasper0712 1:f5cda0674f24 5 #include "N5110.h"
jasper0712 1:f5cda0674f24 6 #include "Gamepad.h"
jasper0712 1:f5cda0674f24 7 #include "Weapon.h"
jasper0712 1:f5cda0674f24 8
jasper0712 1:f5cda0674f24 9 //Y rows and X columns
jasper0712 1:f5cda0674f24 10 #define Rows 48
jasper0712 1:f5cda0674f24 11 #define Cols 84
jasper0712 1:f5cda0674f24 12
jasper0712 30:2e2d48cbfec3 13 struct Stats {
jasper0712 30:2e2d48cbfec3 14 int spawnRate;
jasper0712 30:2e2d48cbfec3 15 int health;
jasper0712 30:2e2d48cbfec3 16 };
jasper0712 1:f5cda0674f24 17 class Spawn
jasper0712 1:f5cda0674f24 18 {
jasper0712 1:f5cda0674f24 19 public:
jasper0712 1:f5cda0674f24 20 Spawn();
jasper0712 1:f5cda0674f24 21 ~Spawn();
jasper0712 30:2e2d48cbfec3 22
jasper0712 30:2e2d48cbfec3 23 void init(int w);
jasper0712 30:2e2d48cbfec3 24
jasper0712 25:edd6a95607b1 25 void randomizeSpawn(int Arr[][Rows], char cArr[][Rows]);
jasper0712 30:2e2d48cbfec3 26 //http://stackoverflow.com/questions/10289197/how-to-empty-a-2d-char-array-in-c
jasper0712 30:2e2d48cbfec3 27 void moveSpawnABC(int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows]);
jasper0712 30:2e2d48cbfec3 28 void moveSpawnB(int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows]);
jasper0712 30:2e2d48cbfec3 29 void moveSpawnDE(int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows]);
jasper0712 30:2e2d48cbfec3 30
jasper0712 30:2e2d48cbfec3 31 //a tool to clean up the array
jasper0712 30:2e2d48cbfec3 32 void updateSpawn(int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows], N5110 &lcd);
jasper0712 30:2e2d48cbfec3 33 void deleteChar(int x, int y, int Arr[][Rows], char cArr[][Rows]);
jasper0712 30:2e2d48cbfec3 34
jasper0712 30:2e2d48cbfec3 35 //messing with the struct
jasper0712 30:2e2d48cbfec3 36 Stats statsA(int w);
jasper0712 30:2e2d48cbfec3 37 Stats statsB(int w);
jasper0712 30:2e2d48cbfec3 38 Stats statsC(int w);
jasper0712 30:2e2d48cbfec3 39 Stats statsDE(int w);
jasper0712 30:2e2d48cbfec3 40
jasper0712 30:2e2d48cbfec3 41 private:
jasper0712 30:2e2d48cbfec3 42 //this makes the spawnA stop spawning for a row and spawn for another.
jasper0712 30:2e2d48cbfec3 43 int stopSpawnA;
jasper0712 23:6d197a452d7c 44 void spawnA(int Arr[][Rows],char cArr[][Rows]); //normal spawn
jasper0712 23:6d197a452d7c 45 void spawnB(int x, int Arr[][Rows],char cArr[][Rows]); //fast moving spawn
jasper0712 23:6d197a452d7c 46 void spawnC(int Arr[][Rows],char cArr[][Rows]); //tanky spawn
jasper0712 25:edd6a95607b1 47 void spawnDE(int x, int Arr[][Rows],char cArr[][Rows]); //zigg-zag spawn (even faster than spawn)
jasper0712 24:d6187d39f09b 48 void movementD(int x, int y, int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows]);
jasper0712 24:d6187d39f09b 49 void movementE(int x, int y, int Arr[][Rows], int Arr2[][Rows], char cArr[][Rows], char cArr2[][Rows]);
jasper0712 6:a554424e4517 50
jasper0712 30:2e2d48cbfec3 51 Stats A;
jasper0712 30:2e2d48cbfec3 52 Stats B;
jasper0712 30:2e2d48cbfec3 53 Stats C;
jasper0712 30:2e2d48cbfec3 54 Stats DE;
jasper0712 30:2e2d48cbfec3 55
jasper0712 30:2e2d48cbfec3 56 //the stats will increase as the game progress
jasper0712 18:d82059ce929b 57 int healthA;
jasper0712 18:d82059ce929b 58 int healthC;
jasper0712 24:d6187d39f09b 59 int healthDE;
jasper0712 18:d82059ce929b 60 int spawnRateA;
jasper0712 18:d82059ce929b 61 int spawnRateB;
jasper0712 18:d82059ce929b 62 int spawnRateC;
jasper0712 24:d6187d39f09b 63 int spawnRateDE;
jasper0712 22:2e75b50b26f0 64
jasper0712 1:f5cda0674f24 65 };
jasper0712 1:f5cda0674f24 66
jasper0712 3:6b50fe9d3848 67 #endif