“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

lib/Car.h

Committer:
alex_20
Date:
2021-05-06
Revision:
9:6f060f495536
Parent:
6:40ef2030334c

File content as of revision 9:6f060f495536:

#ifndef CAR_H
#define CAR_H

#include "mbed.h"
#include "Utils.h"
#include "N5110.h"
#include "Vector.h"
#include "Joystick.h"
#include <cmath> 

const static int STRAIGHT = 0;
const static int RIGHT = 1;
const static int LEFT = 2;

class Car
{
public:

    Car();
    void init(int direction, int magnitude, int start_pos);
    int get_direction(float coord_x);
    int get_magnitude(float coord_x);
    void draw(N5110 &lcd, int start_pos, float start_angle);
    
private:

    int _direction;
    int _magnitude;
    int _start_pos;
};
#endif