Arturs Kozlovskis / Mbed 2 deprecated ELEC2645_Project_el18ak

Dependencies:   mbed

Committer:
thestudent
Date:
Thu Apr 02 11:51:44 2020 +0000
Revision:
7:82079de8bcd6
Parent:
6:33bdb54c2c88
Child:
8:09eb8fe2bb20
Added a new function to the balls. They can now go in linear or parabolic way. Optimized screen speed. Next is movement randomizer function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thestudent 6:33bdb54c2c88 1 #ifndef FUNCTIONS_H
thestudent 6:33bdb54c2c88 2 #define FUNCTIONS_H
thestudent 6:33bdb54c2c88 3
thestudent 6:33bdb54c2c88 4 //includes
thestudent 6:33bdb54c2c88 5 #include "mbed.h"
thestudent 6:33bdb54c2c88 6 #include "N5110.h"
thestudent 6:33bdb54c2c88 7 #include "Gamepad.h"
thestudent 6:33bdb54c2c88 8 #include "Objects.h"
thestudent 6:33bdb54c2c88 9
thestudent 7:82079de8bcd6 10 struct Ball{
thestudent 7:82079de8bcd6 11 int movement_x_pos[10]; // moves the ball across the screen
thestudent 7:82079de8bcd6 12 int movement_y_counter[10]; //sets the gravity with which the ball will fall
thestudent 7:82079de8bcd6 13 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
thestudent 7:82079de8bcd6 14 int ball_y_pos[10];//balls_y_position
thestudent 7:82079de8bcd6 15 int time_incrementer[10];//increments time value
thestudent 7:82079de8bcd6 16 int ball_x_incrementer[10];//increments movement_x_pos value
thestudent 7:82079de8bcd6 17 int delta_r[10]; // defines the ball size
thestudent 7:82079de8bcd6 18 int initial_starting_pos[10];
thestudent 7:82079de8bcd6 19 };
thestudent 7:82079de8bcd6 20 struct Ball_linear{
thestudent 7:82079de8bcd6 21 int movement_x_pos[10]; // moves the ball across the screen
thestudent 7:82079de8bcd6 22 int movement_y_counter[10]; //sets the gravity with which the ball will fall
thestudent 7:82079de8bcd6 23 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
thestudent 7:82079de8bcd6 24 int ball_y_pos[10];//balls_y_position
thestudent 7:82079de8bcd6 25 int time_incrementer[10];//increments time value
thestudent 7:82079de8bcd6 26 int ball_x_incrementer[10];//increments movement_x_pos value
thestudent 7:82079de8bcd6 27 int delta_r[10]; // defines the ball size
thestudent 7:82079de8bcd6 28 int initial_starting_pos[10];
thestudent 7:82079de8bcd6 29 };
thestudent 7:82079de8bcd6 30
thestudent 6:33bdb54c2c88 31 class Functions
thestudent 6:33bdb54c2c88 32 {
thestudent 6:33bdb54c2c88 33 public:
thestudent 6:33bdb54c2c88 34 Functions();
thestudent 7:82079de8bcd6 35 void ball_position_parabolic( N5110 &lcd, Objects &objects,int c);//governs the balls movement in a parabolic way
thestudent 7:82079de8bcd6 36 void ball_position_linear (N5110 &lcd, Objects &objects,int c);//governs the balls movement in a linear way
thestudent 6:33bdb54c2c88 37
thestudent 6:33bdb54c2c88 38 private:
thestudent 6:33bdb54c2c88 39 int _initial_radiuss;//holds the intial ball radiuss which is 2
thestudent 6:33bdb54c2c88 40 };
thestudent 6:33bdb54c2c88 41 #endif