Arturs Kozlovskis / Mbed 2 deprecated ELEC2645_Project_el18ak

Dependencies:   mbed

My_game_clases/Functions.h

Committer:
thestudent
Date:
2020-04-18
Revision:
10:f5b920a6a71a
Parent:
9:4b11ee1155ad
Child:
11:4722bf70b2be

File content as of revision 10:f5b920a6a71a:

#ifndef FUNCTIONS_H
#define FUNCTIONS_H

//includes
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Objects.h"

struct Ball{
    int ball_x_pos[10]; // moves the ball across the screen
    float movement_y_counter[10]; //sets the gravity with which the ball will fall
    int time[10];//the time as in the y postion of the ball which will governed by equation y = _y_initial + _movement_y_counter * _time^2
    int ball_y_pos[10];//balls_y_position
    int time_incrementer[10];//increments time value
    int ball_x_incrementer[10];//increments movement_x_pos value
    int delta_r[10]; // defines the ball size    
    int initial_starting_pos[10];
    int time_limit[10];// restrict time to 6 or 5 depending on the balls size
    
};
struct Ball_linear{
    int ball_x_pos[10]; // moves the ball across the screen
    int movement_y_counter[10]; //sets the gravity with which the ball will fall
    int time[10];//the time as in the y postion of the ball which will governed by equation y = _y_initial + _movement_y_counter * _time^2
    int ball_y_pos[10];//balls_y_position
    int time_incrementer[10];//increments time value
    int ball_x_incrementer[10];//increments movement_x_pos value
    int delta_r[10]; // defines the ball size    
    int initial_starting_pos[10];
    int time_limit[10];// restrict time to 6 or 5 depending on the balls size
};

class Functions 
{
public:
    Functions();
    void ball_position_parabolic( N5110 &lcd, Objects &objects,int c);//governs the balls movement in a parabolic way
    void ball_position_linear (N5110 &lcd, Objects &objects,int c);//governs the balls movement in a linear way
    void collision_checker(N5110 &lcd,Objects &objects);//checks if the shot has coma into contact with the ball
    void ball1_finder(int x, int y);//checks which ball has been hit by a shot and then decreses it size(linear)
    void ball_finder(int x, int y);//checks which ball has been hit by a shot and then decreses it size(parabolic)
    bool cannon_smash(N5110 &lcd,Objects &objects);

private:
    int _initial_radiuss;//holds the intial ball radiuss which is 2
    int _cannon_y_pos; // holds the cannons y position
};
#endif