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 FATFileSystem
Diff: Ball/Ball.h
- Revision:
- 9:bc34f2243e43
- Parent:
- 8:d410856c6d04
- Child:
- 10:9f54a6366e94
diff -r d410856c6d04 -r bc34f2243e43 Ball/Ball.h
--- a/Ball/Ball.h Thu Apr 18 10:42:42 2019 +0000
+++ b/Ball/Ball.h Sat Apr 20 10:42:17 2019 +0000
@@ -6,7 +6,7 @@
#include "Gamepad.h"
/** Enum for wall types */
-enum Wall {
+enum WallType {
LEFT, /**< left wall */
RIGHT, /**< right wall */
@@ -20,13 +20,22 @@
int y; /**< coordinate of y pixel */
};
-/** Course Information struct */
-struct Course {
- Wall wall; /**< wall type */
+/** Map Layout struct */
+struct WallMap {
+ WallType wall; /**< wall type */
Coord start; /**< coordinate of line start */
Coord end; /**< coordinate of line end */
};
+/** Levels Information struct */
+struct Levels {
+ Coord ball; /**< start position of ball */
+ Coord hole; /**< position of hole */
+ WallMap walls[10]; /**< array of wall plots */
+ int wall_count;
+
+};
+
/** Ball Class
* @brief Class for controlling the golf ball
* @author Ellis Blackford Stroud
@@ -44,7 +53,7 @@
/** Destructor */
~Ball();
- void init(float x_pos, float y_pos);
+ void init(Coord start_pos);
void drawBall(N5110 &lcd);
@@ -61,10 +70,14 @@
void shoot_ball(Gamepad &pad, Vector2D joy_coord);
int get_shot_count();
+
+ int get_total_shot_count();
- void set_vel(float x_vel, float y_vel);
+ void set_total_shot_count(int total_shot_count);
+
+ bool check_hole(Coord hole);
- void check_wall_bounce(Course map[], int size);
+ void check_wall_bounce(WallMap map[], int size);
void left_bounce(Coord start, Coord end);
@@ -74,16 +87,14 @@
void bottom_bounce(Coord start, Coord end);
-
-
private:
-
float _x_pos;
float _y_pos;
float _x_vel;
float _y_vel;
int _shot_count;
+ int _total_shot_count;
Direction _direction;
};