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: Enemy/Enemy.h
- Revision:
- 9:3a0194c87afe
- Parent:
- 7:08f78909dda7
diff -r d1c04f0e4890 -r 3a0194c87afe Enemy/Enemy.h
--- a/Enemy/Enemy.h Sat May 11 08:23:54 2019 +0000
+++ b/Enemy/Enemy.h Sun May 12 16:21:08 2019 +0000
@@ -1,3 +1,8 @@
+/** My Enemy Class
+* @brief Stores and draws location and sprite data involving one enemy and checks for collisions with walls.
+* @author Thomas Foster
+* @date May, 2019
+*/
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
@@ -5,12 +10,38 @@
class Enemy { // Deals with information regarding 1 enemy
public:
+ /** Constructor */
Enemy();
+
+ /** Initialise all in game variables
+ */
void init();
+
+ /** Updates all Enemy variables
+ * @param Does the enemy exist? (int)
+ * @param x position (int)
+ * @param y position (int)
+ */
int write(int enemy_true, int x1, int y1);
+
+ /** Draws Enemy sprite on screen
+ * @param The N5110 library (N5110)
+ */
void draw(N5110 &lcd);
+
+ /** Gets x position
+ * @return Enemy x position (int)
+ */
int get_x();
+
+ /** Gets y position
+ * @return Enemy y position (int)
+ */
int get_y();
+
+ /** Gets collision
+ * @return Collision with wall (int)
+ */
bool check_collision();
private:
@@ -22,8 +53,6 @@
int _row;
int _map_x;
int _map_y;
- int _m; // used for drawing
+ int _m;
int _n;
- // int spacesi;
- // int const enemy[10][20];
};