Shell code for P2-2 in ECE 2035 (Fall 2017) at Georgia Tech. This repo includes a game engine for a Labyrinth-style ball game.

Dependencies:   4DGL-uLCD-SE mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
rconnorlawson
Date:
Wed Nov 08 21:01:43 2017 +0000
Parent:
0:cf4396614a79
Commit message:
Fix delta computation in physics update.

Changed in this revision

game.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/game.cpp	Fri Nov 03 18:48:48 2017 +0000
+++ b/game.cpp	Wed Nov 08 21:01:43 2017 +0000
@@ -90,11 +90,12 @@
         // Physics Update
         ///////////////////
         // Rate limit: 1 ms
-        if (tick - phys_tick < 1) continue;
+        int diff = tick - phys_tick;
+        if (diff < 1) continue;
         phys_tick = tick;
 
         // Compute elapsed time in milliseconds
-        float delta = (tick-phys_tick)*1e-3;
+        float delta = diff*1e-3;
 
         // Read inputs
         GameInputs inputs = read_inputs();