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 MotionSensor
Diff: Bullets/Bullets.h
- Revision:
- 60:44ddfb791e2b
- Parent:
- 59:fd4669864b67
diff -r fd4669864b67 -r 44ddfb791e2b Bullets/Bullets.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Bullets/Bullets.h Thu May 09 14:55:43 2019 +0000
@@ -0,0 +1,55 @@
+#ifndef BULLETS_H
+#define BULLETS_H
+#include "Entity.h"
+
+/**Bullets Class
+*@author Steven Mahasin
+*@brief Creates a Bullet which inherits the Entity class, this will be a created projectile by the player class
+*@date May 2019
+*/
+class Bullets : public Entity
+{
+
+public:
+ /** Constructor
+ * @brief creates a bullet at positions pos_x and pos_y travelling at face dir
+ * @param pos_x - initialise _position.x
+ * @param pos_y - initialise _position.y
+ * @param dir - initialise _face
+ */
+ Bullets(float pos_x, float pos_y, int dir);
+
+ // Functions
+ /**
+ * @brief function moves the bullet on it's face at a speed
+ * @param speed - the speed of the bullet
+ * @param unused - not used
+ * @param map - not used
+ * @param doorways - not used
+ */
+ virtual void move(float speed, float unused, char * map, bool * doorways);
+ /**
+ * @brief draws the bullet onto the screen
+ * @param lcd - the screen where the bullet is drawn
+ */
+ virtual void draw(N5110 &lcd);
+ /**
+ * @brief reduce _hp by damage
+ * @param damage - the amount of damage to be taken
+ */
+ virtual void take_damage(int damage);
+ /**
+ * @brief checks if the bullet is out of bounds (hit wall or out of screen)
+ * @param map - the 2d map array that dictates where there are walls or empty space
+ * @param doorways - an array that dictates which side of the wall has a doorway
+ * @returns true if bullet is out of bounds
+ */
+ bool out_of_bounds_check(char * map, bool * doorways);
+};
+
+const char bullets_sprite[3][3] = {{1,1,1},
+ {1,1,1},
+ {1,1,1}
+};
+
+#endif
\ No newline at end of file