changed the constants format and added debug mode

This commit is contained in:
2021-05-09 15:18:51 +02:00
parent 55f0d2f0da
commit 9be6801ba1
2 changed files with 18 additions and 13 deletions

View File

@@ -2,8 +2,8 @@
-- Crates are the main thing so here we go
local Timer = require('deps.knife.timer')
local CONST_ITERATIONS_RESOLVE = .01
local CONST_TIME_TO_RELOAD = .4
ITERATIONS_RESOLVE = .01
TIME_TO_RELOAD = .4
local Crates = {
world = nil,
@@ -30,7 +30,7 @@ function Crate.new(world, x, y)
contact:setEnabled(false)
object.contact.x, object.contact.y = contact:getPositions()
object.attached = true
Timer.after(CONST_ITERATIONS_RESOLVE, function ()
Timer.after(ITERATIONS_RESOLVE, function ()
object.joint = Crates.world:addJoint('revolute', Crates.player.collider, object.collider, object.contact.x, object.contact.y, true)
table.insert(Crates.attached, object)
end)
@@ -61,7 +61,7 @@ end
function Crates:detach(key)
self.attached[key].joint._joint:destroy()
Timer.after(CONST_TIME_TO_RELOAD, function ()
Timer.after(TIME_TO_RELOAD, function ()
self.attached[key].attached = false
table.remove(self.attached, key)
end)