Henry Triff / Mbed 2 deprecated ELEC2645_Project_el18ht

Dependencies:   mbed

Revision:
6:5f76dd718dc3
Parent:
5:2d9f3c36bcb9
Child:
7:2ce6e90f6d47
--- a/Mechanics/Mechanics.cpp	Tue Feb 11 17:28:56 2020 +0000
+++ b/Mechanics/Mechanics.cpp	Wed Feb 19 21:40:21 2020 +0000
@@ -119,7 +119,6 @@
     } else {
         next_gate = 0;
     }
-    printf("%i  ",next_gate);
 
     if(position.x >= gates[next_gate].TL.x && position.x <= gates[next_gate].BR.x && position.y <= gates[next_gate].TL.y && position.y >= gates[next_gate].BR.y) {
         return next_gate;
@@ -143,4 +142,39 @@
         }
     }
     return laps;
-}
\ No newline at end of file
+}
+
+Time Mechanics::Convert_To_Time(int game_fps, int number_of_frames)
+{
+    int total_seconds = float(number_of_frames) / float(game_fps);
+    int seconds = total_seconds % 60;
+    float miliseconds_decimal = (float(number_of_frames) / float(game_fps)) - seconds;
+    int miliseconds = float(miliseconds_decimal * 1000);
+    int minuites = (total_seconds - seconds) / 60;
+    return {minuites, seconds, miliseconds};
+}
+
+//***************
+//  BOOST PLATE
+//***************
+
+float Mechanics::Get_Boost_Speed(Triangle_2D plates[], int number_of_plates, Point_2D position, float speed)
+{
+    for(int i = 0; i < number_of_plates; i++) {
+        if(position.x > plates[i].TL.x && position.x < plates[i].BR.x && position.y < plates[i].TL.y && position.y > plates[i].BR.y) {
+            speed = 6;
+        }
+    }
+    return speed;
+}
+
+
+
+
+
+
+
+
+
+
+