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.
Diff: My_game_clases/Objects.h
- Revision:
- 21:32429d8e90ff
- Parent:
- 16:e2aaef863d7c
- Child:
- 25:b0c1d7955678
--- a/My_game_clases/Objects.h Sat May 09 10:53:46 2020 +0000
+++ b/My_game_clases/Objects.h Tue May 12 15:12:59 2020 +0000
@@ -5,35 +5,83 @@
#include "N5110.h"
#include "Gamepad.h"
#include <vector>
-
-
+/** Object class
+* @brief draws game objects on the lcd screen
+* @author Arturs Kozlovskis
+* @date April,2020
+*/
class Objects
{
public:
+ /**Constructor */
Objects();//initialises variables
+
+ /** Draw the base of the game
+ * @param N5110 class object
+ */
void draw_base(N5110 &lcd);// draws the base
+
+ /** Update the cannon position
+ * @param Gamepad class object
+ */
void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick
+
+ /** Draw a cannon
+ * @param N5110 class object
+ */
void draw_cannon(N5110 &lcd);//draws the cannon
+
+ /** Draw shots
+ * @param N5110 class object
+ * @param Gamepad class object
+ * @param update value(bool)
+ */
void draw_shots(N5110 &lcd,Gamepad &pad,bool c);// makes the shoting on the screen
- //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger
- void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r);//draws the ball
+
+ /** Draw ball
+ * @param N5110 calss object
+ * @param ball x position(int)
+ * @param ball y position(int)
+ * @param the delta radiuss(int)
+ */
+ void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r); //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger
+
+ /** Get size value of _shot_y_pos vector
+ * @return size of vector
+ */
int get_size();//gets the size of _shot_y_pos vector
+ /** Get x value
+ * @param which shot value to return(int)
+ * @return shot x value
+ */
int get_x_value(int i);//gets _shot_x_pos(i)
+
+ /** Get y value
+ * @param which shot value to return(int)
+ * @return shot y value
+ */
int get_y_value(int i);//gets _shot_y_pos(i)
+
+ /** Erase a shot
+ * @param which shot value to erase(int)
+ */
void erase_shot(int i);//erases _shot_x_pos(i) and _shot_y_pos(i)
+
+ /** Get cannon x position
+ * @return cannon x position
+ */
int get_x_cannon();
- vector <int> _shot_y_pos; //holds the shots y positions
- vector <int> _shot_x_pos;//holds the shots x positons
-
-
private:
+ //variables
int _cannon_pos; //stores the positon of the cannon
int _initial_shot_pos;//stroes the initial vertical position of the shot
int _shot_incrementer;//increments the shot on the lcd by 2
int _radiuss;// the initiak radiuss of the ball
+ vector <int> _shot_y_pos; //holds the shots y positions
+ vector <int> _shot_x_pos;//holds the shots x positons
};
#endif
\ No newline at end of file