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.
Dependencies: mbed
Diff: AlienBullet/AlienBullet.h
- Revision:
- 38:6f50b548226e
- Parent:
- 31:27c938ec2a11
- Child:
- 40:35f27f0e7833
--- a/AlienBullet/AlienBullet.h Mon May 25 14:15:50 2020 +0000
+++ b/AlienBullet/AlienBullet.h Mon May 25 15:25:14 2020 +0000
@@ -3,21 +3,46 @@
#include "Gamepad.h"
/** Alien Bullet class
-* @brief Creates and controlsalien bullet object
+* @brief Creates and controls alien bullet object
* @author Joshua O'hara
* @date May, 2017
*/
+
class AlienBullet
{
+
public:
+
+ /**Constructor*/
AlienBullet();
+
+ /**Destructor*/
~AlienBullet();
+
+ /**Sets private variables to starting values*/
void init(int x, int y); //initialises objects and sets private variables
+
+ /**Draws the bullet if it has not yet been hit*/
void render(N5110 &lcd); //draws bullet
+
+ /**Updates relevant private variables*/
void update(); //udpdates private variables
+
//accessors and mutators
+
+ /**Returns a 2D vector of the x and y position of the bullet
+ *@return bullets position (Vector2D)
+ */
Vector2D get_position(); //returns the x and y position of the bullet
+
+ /**Sets the hit value of the bullet, hit = true means bullet has hit something
+ *@param _hit (bool)
+ */
void set_hit(bool x); //sets the hit value of the bullet
+
+ /**Returns the hit value of the bullet
+ *@return _hit (bool)
+ */
bool get_hit(); //returns the hit value of the bullet
private:
@@ -25,7 +50,6 @@
int _x; //x position of the bullet
int _speed; //speed of the bullet (y direction)
bool _hit; //variable to show if bullet has caused a hit, functions the same as the life variable of the ship but logically opposite
-
};
\ No newline at end of file