
AsteroidDefender
Dependencies: 4DGL-uLCD-SE DebounceIn mbed
Diff: game.h
- Revision:
- 1:34bb7c386b9f
- Parent:
- 0:bbc2ad180020
--- a/game.h Tue Oct 20 02:49:21 2015 +0000 +++ b/game.h Tue Oct 20 03:06:14 2015 +0000 @@ -6,13 +6,12 @@ double y; }; +//Class for the asteroids falling from the sky class Missile{ private: public: bool moved; - bool interactive; //collidable in physics - bool render; double x_change; double y_change; vec2 spawn; @@ -21,20 +20,16 @@ vec2 old_coord; vec2 size; int steps; - //vec2 velocity; - //Color color; vec2 prev_coord; - //vec2 prev_size; -Missile(vec2 giv_spawn, vec2 giv_dest, int steps_in) : moved(false), interactive(true), render(true) +Missile(vec2 giv_spawn, vec2 giv_dest, int steps_in) : moved(false) { spawn = giv_spawn; dest = giv_dest; coord = giv_spawn; old_coord = coord; - //color = RED; size.x = 6; size.y = 6; steps = steps_in; @@ -43,9 +38,8 @@ } +//When called, moves the asteroid towards the bottom void move(){ -// float x_change = 20; -// float y_change = 20; old_coord = coord; moved = true; coord.x = coord.x + x_change; @@ -53,18 +47,17 @@ } }; +//Handles all the fired projectiles class Projectile{ private: public: bool moved; - bool interactive; //collidable in physics - bool render; vec2 old_coord; vec2 coord; vec2 size; -Projectile(vec2 coord_in) : moved(false), interactive(true), render(true) +Projectile(vec2 coord_in) : moved(false) { coord.x = coord_in.x + 3; coord.y = coord_in.y + 6; @@ -74,26 +67,23 @@ } void move(){ -// float x_change = 20; -// float y_change = 20; old_coord = coord; moved = true; coord.y = coord.y - 4; } }; +//Handles the object the user controls class Shooter{ private: public: bool moved; - bool interactive; //collidable in physics - bool render; vec2 coord; vec2 old_coord; vec2 size; -Shooter() : moved(false), interactive(true), render(true) +Shooter() : moved(false) { coord.x = 58; coord.y = 125;