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 Gamepad N5110 mbed-rtos
Diff: MiniEnemy/MiniEnemy.h
- Revision:
- 7:574c66ebd8b0
- Child:
- 9:c5a19e358c07
diff -r 1fcfd331c047 -r 574c66ebd8b0 MiniEnemy/MiniEnemy.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MiniEnemy/MiniEnemy.h Thu May 09 09:54:50 2019 +0000
@@ -0,0 +1,100 @@
+#ifndef MINIENEMY_H
+#define MINIENEMY_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+
+/** MiniEnemy Class
+ * @brief Enemy for the minigame
+ * @author Rex Roshan Raj
+ */
+class MiniEnemy
+{
+
+public:
+ /** Constructor */
+ MiniEnemy();
+
+ /** Destructor */
+ ~MiniEnemy();
+
+ /** Initialises the parameters */
+ void init();
+
+ /** Generates the location
+ * @brief Generates and sets the location of the enemy once it has been hit
+ */
+ Vector2D location();
+
+ /** Draws the enemy
+ * @param N5110 lcd
+ * @brief Draws the enemy in stage one
+ */
+ void enemy(N5110 &lcd);
+
+ /** Updates the movement
+ * @brief Changes the y position for animation once the enemy has died
+ */
+ void update();
+
+ /** Adds the value of score by 1 */
+ void add_score();
+
+ /** Gets the value of the score
+ * @returns value in range 0 to 10
+ */
+ int get_score();
+
+ /** Adds the value of health by 1 */
+ void add_health();
+
+ /** Gets the value of the health
+ * @returns value in range 0 to 5
+ */
+ int get_health();
+
+ /** Sets the value of the health
+ * @returns value of 0
+ */
+ int set_health();
+
+ /** Adds 1 to movement speed*/
+ void add_fast();
+
+ /** Gets the value of the fast
+ * @returns value in range 1 to 7
+ */
+ int get_fast();
+
+ /** Sets the value of the fast
+ * @returns value in range 0
+ */
+ int set_fast();
+
+ /** Gets the position of the enemy
+ * @returns a struct with x,y members which corresponds to x and y position respectively
+ */
+ Vector2D get_enemy_pos();
+
+ /** Sets the position of the enemy
+ * @param position of the enemy
+ */
+ void set_enemy_pos(Vector2D e);
+
+
+private:
+
+ // methods
+ Vector2D _location;
+ int a;
+ int b;
+ int x;
+ int y;
+ int _fast;
+ int _score;
+ int _health;
+
+};
+
+#endif
\ No newline at end of file