diff --git a/systems/collision-detection.lua b/systems/collision-detection.lua index 97a6528..339309b 100644 --- a/systems/collision-detection.lua +++ b/systems/collision-detection.lua @@ -37,8 +37,8 @@ world:filteredSystem( system.world:addEntity({ collisionBetween = { collider = collider, - collidedInto = e - } + collidedInto = e, + }, }) end end diff --git a/systems/input.lua b/systems/input.lua index 7bffc43..6689bbc 100644 --- a/systems/input.lua +++ b/systems/input.lua @@ -18,33 +18,33 @@ function love.keypressed(key, _, _) keyState[key] = true end -function ClearKeyState() - for key in pairs(keyState) do - keyState[key] = nil - end -end +-- function ClearKeyState() +-- for key in pairs(keyState) do +-- keyState[key] = nil +-- end +-- end -local mouse = world:filteredSystem("mouse", { mouseKeyPress = { position = T.XyPair, key = T.number } }) - -function MouseJustPressed(key, clear) - clear = clear ~= nil and clear or true - for _, event in pairs(mouse.entities) do - if event.mouseKeyPress and event.mouseKeyPress.key == key then - if clear then - event.mouseKeyPress = nil - world:removeEntity(event) - end - return true - end - end - return false -end - -local mouseX, mouseY = -9999, -9999 - -function love.mousemoved(x, y) - mouseX, mouseY = x, y -end +-- local mouse = world:filteredSystem("mouse", { mouseKeyPress = { position = T.XyPair, key = T.number } }) +-- +-- function MouseJustPressed(key, clear) +-- clear = clear ~= nil and clear or true +-- for _, event in pairs(mouse.entities) do +-- if event.mouseKeyPress and event.mouseKeyPress.key == key then +-- if clear then +-- event.mouseKeyPress = nil +-- world:removeEntity(event) +-- end +-- return true +-- end +-- end +-- return false +-- end +-- +-- local mouseX, mouseY = -9999, -9999 +-- +-- function love.mousemoved(x, y) +-- mouseX, mouseY = x, y +-- end function love.mousepressed(x, y, key) world:addEntity({ diff --git a/systems/velocity.lua b/systems/velocity.lua index bac463b..d9044de 100644 --- a/systems/velocity.lua +++ b/systems/velocity.lua @@ -2,9 +2,7 @@ local world = require("world") local sqrt = math.sqrt world:filteredSystem("velocity", { position = T.XyPair, velocity = T.XyPair }, function(e, dt, _) - if sqrt((e.velocity.x * e.velocity.x) + (e.velocity.y * e.velocity.y)) < 2 then - -- velocity = nil - else + if sqrt((e.velocity.x * e.velocity.x) + (e.velocity.y * e.velocity.y)) >= 2 then e.position.x = e.position.x + (e.velocity.x * dt) e.position.y = e.position.y + (e.velocity.y * dt) end