“Race Collision” is a one player game in which a truck has to avoid “particles” that appear on the road. By the use of the joystick, the player can guide themselves through the menu system to start the game. The truck is the main element of the game and it can be moved from side to side with the joystick. The road curves randomly from time to time and the player has to be careful to keep the truck within the road boundaries. Particles appear on the screen at random positions and 4 collisions lead to the end of the game.
Dependencies: ELEC2645_JoystickLCD_LPC1768_2021
Diff: lib/Utils.h
- Revision:
- 3:cbe2dcca5058
- Parent:
- 1:2ae7a8b01771
- Child:
- 4:def20a1665d1
diff -r 18fd28044860 -r cbe2dcca5058 lib/Utils.h --- a/lib/Utils.h Thu Mar 18 13:21:12 2021 +0000 +++ b/lib/Utils.h Fri Mar 19 20:04:39 2021 +0000 @@ -1,14 +1,43 @@ #ifndef UTILS_H #define UTILS_H +#include "mbed.h" +#include "N5110.h" + struct Position2D { int x; int y; }; -struct Vector2D { - float x; - float y; +typedef struct Vector2Df { float x; float y; } Vector2Df; + +Class Utils +{ + public: + + /** Take points from curve + * + * This function takes all the points from a curve and stores them in a vector + * @param x0 - x-coordinate of first point + * @param y0 - y-coordinate of first point + * @param x1 - x-coordinate of second point + * @param y1 - y-coordinate of second point + * @param x2 - x-coordinate of third point + * @param y2 - y-coordinate of third point + */ + std::vector<Vector2Df> getCurve(float const x0, + float const y0, + float const x1, + float const y1, + float const x2, + float const y2); + + + float curveEquation(float const n1, + float const n2, + float perc ); + + }; #endif \ No newline at end of file