diff --git a/js/elements/physics_objects.js b/js/elements/physics_objects.js index 8c64522..cd2c8e9 100644 --- a/js/elements/physics_objects.js +++ b/js/elements/physics_objects.js @@ -1,7 +1,5 @@ // Physics objects (square, circle, triangle) -const SQUARE = 16; -const CIRCLE = 17; -const TRIANGLE = 18; +// Constants are already defined in constants.js // Physics object properties const PHYSICS_OBJECT_COLORS = ['#FF5733', '#33FF57', '#3357FF', '#F3FF33', '#FF33F3']; diff --git a/js/main.js b/js/main.js index f2ffe82..dbef5cd 100644 --- a/js/main.js +++ b/js/main.js @@ -64,6 +64,11 @@ window.onload = function() { // Start the simulation loop requestAnimationFrame(simulationLoop); + + // Initialize physics variables + window.physicsUpdateRate = 16; // ms between physics updates + window.lastPhysicsTime = 0; + window.fireUpdateCounter = 0; }; function resizeCanvas() { diff --git a/js/physics.js b/js/physics.js index 4420747..75a0ed4 100644 --- a/js/physics.js +++ b/js/physics.js @@ -8,7 +8,9 @@ function updatePhysics(timestamp) { lastPhysicsTime = timestamp || 0; // Update physics objects - updatePhysicsObjects(); + if (typeof updatePhysicsObjects === 'function') { + updatePhysicsObjects(); + } // Get visible chunks const visibleChunks = getVisibleChunks();