Zikang Qian / Mbed 2 deprecated el17z2q

Dependencies:   mbed

Fork of el17z2q by ELEC2645 (2017/18)

Branch:
GameEngine
Revision:
2:6dc7bc55c1cb
Parent:
1:00a4ea97c4cd
--- a/GameEngine/CoinWithBag-test.h	Mon May 07 21:24:25 2018 +0000
+++ b/GameEngine/CoinWithBag-test.h	Mon May 07 22:11:43 2018 +0000
@@ -15,37 +15,41 @@
     Bag bag;
     GameEngine game;
     
+    // initial size of coin and bag
     coin.init(2.5,1);
     bag.init(17,2,1);
     game.init(17,2,2.5,1);
 
+    // initial position of coin
     Vector2D initial_coin_position = {5, 0};
     coin.set_position(initial_coin_position);
     
+    // initial position of bag, where below the coin
     Vector2D initial_bag_position = {3, 46};
     bag.set_position(initial_bag_position);
 
-    // Read the position
+    // Read the position of coin
     Vector2D read_coin_position = coin.get_position();
     printf("%f, %f\n", read_coin_position.x, read_coin_position.y);
     
+    // Read the position of bag
     Vector2D read_bag_position = bag.get_position();
     printf("%f, %f\n", read_bag_position.x, read_bag_position.y);
 
-    // Set the velocity to -2, 3
-    Vector2D velocity = {0, 46};
+    // Set the velocity to 0,47 so that coin can collide with bag immediately
+    Vector2D velocity = {0, 47};
     coin.set_velocity(velocity);
 
-    // Update the position
+    // Update the coin and bag
     coin.update();
     bag.update();
     
+    // get the result of colliding analysis
     int nodead = game.update(pad);
     
-    // Now check that both the positions are as expected
     bool success = true;
     
-    // Fail the test if the initial position is wrong
+    // failed if game over
     if (nodead != 1) {
         success = false;
     }