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@9:4b11ee1155ad, 2020-04-10 (annotated)
- Committer:
- thestudent
- Date:
- Fri Apr 10 08:24:48 2020 +0000
- Revision:
- 9:4b11ee1155ad
- Parent:
- 6:33bdb54c2c88
- Child:
- 10:f5b920a6a71a
Got the shots to interact with the balls
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 | 6:33bdb54c2c88 | 11 | class Objects{ |
thestudent | 6:33bdb54c2c88 | 12 | public: |
thestudent | 6:33bdb54c2c88 | 13 | |
thestudent | 6:33bdb54c2c88 | 14 | Objects();//initialises variables |
thestudent | 6:33bdb54c2c88 | 15 | void draw_base(N5110 &lcd);// draws the base |
thestudent | 6:33bdb54c2c88 | 16 | void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick |
thestudent | 6:33bdb54c2c88 | 17 | void draw_cannon(N5110 &lcd);//draws the cannon |
thestudent | 6:33bdb54c2c88 | 18 | void draw_shots(N5110 &lcd);// makes the shoting on the screen |
thestudent | 6:33bdb54c2c88 | 19 | //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger |
thestudent | 6:33bdb54c2c88 | 20 | void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r);//draws the ball |
thestudent | 9:4b11ee1155ad | 21 | int get_size();//gets the size of _shot_y_pos vector |
thestudent | 9:4b11ee1155ad | 22 | int get_x_value(int i);//gets _shot_x_pos(i) |
thestudent | 9:4b11ee1155ad | 23 | int get_y_value(int i);//gets _shot_y_pos(i) |
thestudent | 9:4b11ee1155ad | 24 | void erase_shot(int i);//erases _shot_x_pos(i) and _shot_y_pos(i) |
thestudent | 6:33bdb54c2c88 | 25 | |
thestudent | 6:33bdb54c2c88 | 26 | vector <int> _shot_y_pos; //holds the shots y positions |
thestudent | 6:33bdb54c2c88 | 27 | vector <int> _shot_x_pos;//holds the shots x positons |
thestudent | 6:33bdb54c2c88 | 28 | |
thestudent | 6:33bdb54c2c88 | 29 | |
thestudent | 6:33bdb54c2c88 | 30 | private: |
thestudent | 6:33bdb54c2c88 | 31 | int _cannon_pos; //stores the positon of the cannon |
thestudent | 6:33bdb54c2c88 | 32 | int _initial_shot_pos;//stroes the initial vertical position of the shot |
thestudent | 6:33bdb54c2c88 | 33 | int _shot_incrementer;//increments the shot on the lcd by 2 |
thestudent | 6:33bdb54c2c88 | 34 | int _radiuss;// the initiak radiuss of the ball |
thestudent | 6:33bdb54c2c88 | 35 | |
thestudent | 6:33bdb54c2c88 | 36 | }; |
thestudent | 6:33bdb54c2c88 | 37 | #endif |