Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed N5110 ShiftReg PinDetect
Diff: Game.h
- Revision:
- 9:da608ae65df9
- Parent:
- 8:9ac6a428fa26
- Child:
- 11:adb68da98262
--- a/Game.h Sat May 02 00:22:43 2015 +0000
+++ b/Game.h Sun May 03 11:48:42 2015 +0000
@@ -3,26 +3,21 @@
#include "State.h"
#include "Resources.h" // TODO: Move to State.h ?
+#include "Entity.h"
#include <vector>
-struct Object
-{
- int x, y, width, height;
- int vx, vy;
- bool onGround;
-};
-
struct Point
{
int x;
int y;
+ int vx, vy;
};
class Game : public State
{
public:
Game(StateManager* fsm, N5110 *lcd, InputManager* input)
- : State(fsm, lcd, input) {player.x = 10; player.y = 10; player.width = 5; player.height = 5; player.vy = 0; player.vx = 0; player.onGround = false; init();}
+ : State(fsm, lcd, input) {init();}
virtual void update(float dt);
virtual void render();
@@ -30,13 +25,10 @@
void init();
private:
- Object player;
+ Entity player;
+ bool onGround; // true if player is on ground
- static void btnAPress();
- static void btnBPress();
- static bool btnAPressed;
- static bool btnBPressed;
- // Buttons interrupts
+ bool releasedBtnB;
std::vector<Point*> bullets;
};