Nemesis game, second enemy

Revision:
8:722dec08a18c
Parent:
7:56bb2fb8b9f3
--- a/Enemy2.cpp	Tue May 02 22:14:15 2017 +0000
+++ b/Enemy2.cpp	Wed May 03 20:04:00 2017 +0000
@@ -2,24 +2,27 @@
 
 Enemy2::Enemy2()
 {
-
 }
 
 Enemy2::~Enemy2()
 {
+}
 
-}
+
+// Initializion method:
 
 void Enemy2::init(int speed)
 {   
-    int x = rand() % 63 + 84;
-    _x = x;
-    _y = 7;
+    _x = rand() % 63 + 84;  // Starting x position is randomized off screen. Creates a random ship generation.
+    _y = 7;                 // Starting y position (fixed, second lane)
 
-    _velocity.x = -speed;
+    _velocity.x = -speed;   // Velocity is based on the speed, which is input when method is used.
     _velocity.y = 0;
 }
 
+
+// Draws second enemy ship onto LCD:
+
 void Enemy2::draw(N5110 &lcd)
 {
     lcd.drawLine(_x,_y,_x,_y+5,1);
@@ -29,12 +32,19 @@
     lcd.drawLine(_x-4,_y+2,_x-4,_y+3,1);
 }
 
+
+// Updates second enemy ship's position:
+
 void Enemy2::update()
 {
+    // X and y positions depend on velocity:
     _x += _velocity.x;
     _y += _velocity.y;
 }
 
+
+// Obtains second enemy ship's current position:
+
 Vector2D Enemy2::get_pos()
 {
     Vector2D p = {_x,_y};