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/Objects.h@14:739115711bf8, 2020-04-29 (annotated)
- Committer:
- thestudent
- Date:
- Wed Apr 29 13:51:14 2020 +0000
- Revision:
- 14:739115711bf8
- Parent:
- 10:f5b920a6a71a
- Child:
- 16:e2aaef863d7c
Before changing parabolic ball function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thestudent | 6:33bdb54c2c88 | 1 | #ifndef OBJECTS_H |
thestudent | 6:33bdb54c2c88 | 2 | #define OBJECTS_H |
thestudent | 6:33bdb54c2c88 | 3 | |
thestudent | 6:33bdb54c2c88 | 4 | #include "mbed.h" |
thestudent | 6:33bdb54c2c88 | 5 | #include "N5110.h" |
thestudent | 6:33bdb54c2c88 | 6 | #include "Gamepad.h" |
thestudent | 6:33bdb54c2c88 | 7 | #include <vector> |
thestudent | 6:33bdb54c2c88 | 8 | |
thestudent | 6:33bdb54c2c88 | 9 | |
thestudent | 6:33bdb54c2c88 | 10 | |
thestudent | 10:f5b920a6a71a | 11 | class Objects |
thestudent | 10:f5b920a6a71a | 12 | { |
thestudent | 10:f5b920a6a71a | 13 | public: |
thestudent | 10:f5b920a6a71a | 14 | |
thestudent | 10:f5b920a6a71a | 15 | Objects();//initialises variables |
thestudent | 10:f5b920a6a71a | 16 | void draw_base(N5110 &lcd);// draws the base |
thestudent | 10:f5b920a6a71a | 17 | void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick |
thestudent | 10:f5b920a6a71a | 18 | void draw_cannon(N5110 &lcd);//draws the cannon |
thestudent | 14:739115711bf8 | 19 | void draw_shots(N5110 &lcd,Gamepad &pad);// makes the shoting on the screen |
thestudent | 10:f5b920a6a71a | 20 | //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger |
thestudent | 10:f5b920a6a71a | 21 | void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r);//draws the ball |
thestudent | 10:f5b920a6a71a | 22 | int get_size();//gets the size of _shot_y_pos vector |
thestudent | 10:f5b920a6a71a | 23 | int get_x_value(int i);//gets _shot_x_pos(i) |
thestudent | 10:f5b920a6a71a | 24 | int get_y_value(int i);//gets _shot_y_pos(i) |
thestudent | 9:4b11ee1155ad | 25 | void erase_shot(int i);//erases _shot_x_pos(i) and _shot_y_pos(i) |
thestudent | 10:f5b920a6a71a | 26 | int get_x_cannon(); |
thestudent | 10:f5b920a6a71a | 27 | |
thestudent | 6:33bdb54c2c88 | 28 | vector <int> _shot_y_pos; //holds the shots y positions |
thestudent | 6:33bdb54c2c88 | 29 | vector <int> _shot_x_pos;//holds the shots x positons |
thestudent | 10:f5b920a6a71a | 30 | |
thestudent | 10:f5b920a6a71a | 31 | |
thestudent | 10:f5b920a6a71a | 32 | private: |
thestudent | 10:f5b920a6a71a | 33 | int _cannon_pos; //stores the positon of the cannon |
thestudent | 10:f5b920a6a71a | 34 | int _initial_shot_pos;//stroes the initial vertical position of the shot |
thestudent | 10:f5b920a6a71a | 35 | int _shot_incrementer;//increments the shot on the lcd by 2 |
thestudent | 10:f5b920a6a71a | 36 | int _radiuss;// the initiak radiuss of the ball |
thestudent | 10:f5b920a6a71a | 37 | |
thestudent | 10:f5b920a6a71a | 38 | }; |
thestudent | 10:f5b920a6a71a | 39 | #endif |