changed the constants format and added debug mode
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user