Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
My_game_clases/Functions.h@6:33bdb54c2c88, 2020-04-01 (annotated)
- Committer:
- thestudent
- Date:
- Wed Apr 01 11:20:24 2020 +0000
- Revision:
- 6:33bdb54c2c88
- Child:
- 7:82079de8bcd6
Creating a ball object and working on its movement across the screen. Got the ball going in a linear and parabolic way. For the functioning of the objects created a new class called functions. ;
Who changed what in which revision?
User | Revision | Line number | New 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 | 6:33bdb54c2c88 | 10 | class Functions |
thestudent | 6:33bdb54c2c88 | 11 | { |
thestudent | 6:33bdb54c2c88 | 12 | public: |
thestudent | 6:33bdb54c2c88 | 13 | Functions(); |
thestudent | 6:33bdb54c2c88 | 14 | void ball_position( N5110 &lcd,Objects &objects);//governs the balls movement |
thestudent | 6:33bdb54c2c88 | 15 | |
thestudent | 6:33bdb54c2c88 | 16 | private: |
thestudent | 6:33bdb54c2c88 | 17 | int _initial_radiuss;//holds the intial ball radiuss which is 2 |
thestudent | 6:33bdb54c2c88 | 18 | int _movement_x_pos; // moves the ball across the screen |
thestudent | 6:33bdb54c2c88 | 19 | int _movement_y_counter; //sets the gravity with which the ball will fall |
thestudent | 6:33bdb54c2c88 | 20 | int _time;//the time as in the y postion of the ball which will governed by equation y = _y_initial + _movement_y_counter * _time^2 |
thestudent | 6:33bdb54c2c88 | 21 | int _ball_y_pos;//balls_y_position |
thestudent | 6:33bdb54c2c88 | 22 | int _time_incrementer;//increments time value |
thestudent | 6:33bdb54c2c88 | 23 | int _ball_x_incrementer;//increments movement_x_pos value |
thestudent | 6:33bdb54c2c88 | 24 | int _delta_r; // defines the ball size |
thestudent | 6:33bdb54c2c88 | 25 | }; |
thestudent | 6:33bdb54c2c88 | 26 | #endif |