ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
el17m2h
Date:
Thu May 09 14:30:45 2019 +0000
Parent:
36:0c852c5ade4b
Commit message:
Added comments to the enemy class documentation.

Changed in this revision

Enemy/Enemy.cpp Show annotated file Show diff for this revision Revisions of this file
Enemy/Enemy.h Show annotated file Show diff for this revision Revisions of this file
--- a/Enemy/Enemy.cpp	Thu May 09 14:22:29 2019 +0000
+++ b/Enemy/Enemy.cpp	Thu May 09 14:30:45 2019 +0000
@@ -5,13 +5,16 @@
 Enemy::~Enemy()
 {
 }
-void Enemy::update(Vector2D floor_pos)  // sets its position
+
+// Function to set the enemy's position on top of the floor's position
+void Enemy::update(Vector2D floor_pos)
 {
     _position.x = floor_pos.x + 7 - 6;  // the + 7 for the centre of the floor and the + 6 for the centre of the ghost
     _position.y = floor_pos.y - 1 - 13;  // the - 1 is so that it is on top of the floor's position
     // and the + 15 is so that it considers the position of the feet of the ghost (not the top)
 }
 
+// Draws the enemy to the screen
 void Enemy::draw(N5110 &lcd)
 {
     const int image [12][12] = {
--- a/Enemy/Enemy.h	Thu May 09 14:22:29 2019 +0000
+++ b/Enemy/Enemy.h	Thu May 09 14:30:45 2019 +0000
@@ -16,11 +16,32 @@
 public:
     Enemy();
     ~Enemy();
+    
+    /**
+    @brief Function to set the enemy's position on top of the floor's position
+    @param Vector2D floor_pos
+    @details The function uses the parameters of the enemy and the floor's size to place the enemy on top of the floor.
+    */
     void update(Vector2D floor_pos);
+    
+    /**
+    @brief Prints the enemy into the LCD screen
+    @param N5110 &lcd
+    @details The function draws a sprite of 12 x 12 bits that shows the image of the enemy ghost
+    */
     void draw(N5110 &lcd);
+    
+    /**
+    @brief Function to place the enemy at a position out of the screen's visibility
+    @details The function draws sets the position of the enemy to a value where it will not be visible in the screen
+    */
     void erase();
+    
+    /**
+    @brief Returns the current enemy's position
+    @details Gets the current value in the enemy's class for the enemy's position and returns it as a 2D vector
+    */
     Vector2D get_position();
-    void set_score(int score);
 
 private:
     Vector2D _position;