Class containing methods to draw a ball within the maze game with the specified position, size and fill style parameters.
Diff: Ball.h
- Revision:
- 2:bcb96ab2848b
- Parent:
- 1:ba8bb10ebd5a
- Child:
- 3:569a3f2786ec
diff -r ba8bb10ebd5a -r bcb96ab2848b Ball.h --- a/Ball.h Fri Apr 07 10:29:08 2017 +0000 +++ b/Ball.h Wed May 03 21:13:45 2017 +0000 @@ -1,3 +1,12 @@ +/* + + @file Ball.h + + (c) Max Houghton 02.14.17 + Roller Maze Project, ELEC2645, Univeristy of Leeds + + */ + // // ball.h // @@ -12,9 +21,6 @@ #include "mbed.h" #include "N5110.h" #include "Gamepad.h" -#include "Maze.h" - -#define SPEED 1 class Ball { @@ -24,17 +30,27 @@ Ball(); ~Ball(); - void init(int x, int y, int radius); - void update(); + void init(float x, float y, int radius, bool colour); + void update(Vector2D position); void draw(N5110 &lcd); + Vector2D getPosition(); + Vector2D getVelocity(); + + void setPosition(Vector2D p); + void setVelocity(Vector2D v); + private: Vector2D velocity; + Vector2D checkForInterference(Vector2D velocity); + int _radius; - int _x; - int _y; + + float _x; + float _y; + bool _colour; };