“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

Committer:
alex_20
Date:
Fri Mar 19 20:04:39 2021 +0000
Revision:
3:cbe2dcca5058
Parent:
1:2ae7a8b01771
Child:
4:def20a1665d1
everything in N5110

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alex_20 1:2ae7a8b01771 1 #ifndef UTILS_H
alex_20 1:2ae7a8b01771 2 #define UTILS_H
alex_20 1:2ae7a8b01771 3
alex_20 3:cbe2dcca5058 4 #include "mbed.h"
alex_20 3:cbe2dcca5058 5 #include "N5110.h"
alex_20 3:cbe2dcca5058 6
alex_20 1:2ae7a8b01771 7 struct Position2D {
alex_20 1:2ae7a8b01771 8 int x;
alex_20 1:2ae7a8b01771 9 int y;
alex_20 1:2ae7a8b01771 10 };
alex_20 1:2ae7a8b01771 11
alex_20 3:cbe2dcca5058 12 typedef struct Vector2Df { float x; float y; } Vector2Df;
alex_20 3:cbe2dcca5058 13
alex_20 3:cbe2dcca5058 14 Class Utils
alex_20 3:cbe2dcca5058 15 {
alex_20 3:cbe2dcca5058 16 public:
alex_20 3:cbe2dcca5058 17
alex_20 3:cbe2dcca5058 18 /** Take points from curve
alex_20 3:cbe2dcca5058 19 *
alex_20 3:cbe2dcca5058 20 * This function takes all the points from a curve and stores them in a vector
alex_20 3:cbe2dcca5058 21 * @param x0 - x-coordinate of first point
alex_20 3:cbe2dcca5058 22 * @param y0 - y-coordinate of first point
alex_20 3:cbe2dcca5058 23 * @param x1 - x-coordinate of second point
alex_20 3:cbe2dcca5058 24 * @param y1 - y-coordinate of second point
alex_20 3:cbe2dcca5058 25 * @param x2 - x-coordinate of third point
alex_20 3:cbe2dcca5058 26 * @param y2 - y-coordinate of third point
alex_20 3:cbe2dcca5058 27 */
alex_20 3:cbe2dcca5058 28 std::vector<Vector2Df> getCurve(float const x0,
alex_20 3:cbe2dcca5058 29 float const y0,
alex_20 3:cbe2dcca5058 30 float const x1,
alex_20 3:cbe2dcca5058 31 float const y1,
alex_20 3:cbe2dcca5058 32 float const x2,
alex_20 3:cbe2dcca5058 33 float const y2);
alex_20 3:cbe2dcca5058 34
alex_20 3:cbe2dcca5058 35
alex_20 3:cbe2dcca5058 36 float curveEquation(float const n1,
alex_20 3:cbe2dcca5058 37 float const n2,
alex_20 3:cbe2dcca5058 38 float perc );
alex_20 3:cbe2dcca5058 39
alex_20 3:cbe2dcca5058 40
alex_20 1:2ae7a8b01771 41 };
alex_20 1:2ae7a8b01771 42
alex_20 1:2ae7a8b01771 43 #endif