Mothback/data/scripts/debug.lua

56 lines
2.5 KiB
Lua

function DebugUI()
for _, light in pairs(Lights) do
love.graphics.print(light.pos.x,light.pos.x,light.pos.y)
love.graphics.print(light.pos.y,light.pos.x,light.pos.y+20)
love.graphics.print(light.pos.x,light.pos.x,light.pos.y+40)
end
love.graphics.print("time: "..fps_total..", fps: "..fps_draw..", frametime: "..math.floor(current_dt* 1000).."ms", 10*textScale, 0*textScale, 0, textScale)
love.graphics.setColor(1,1,1)
-- lots of variables
love.graphics.print("[main_Player]",10*textScale,40*textScale, 0, textScale)
love.graphics.print("position: {"..main_Player.pos.x..", "..main_Player.pos.y.."}",10*textScale,60*textScale, 0, textScale)
love.graphics.print("velocity: {"..main_Player.vel.x..", "..main_Player.vel.y.."}",10*textScale,80*textScale, 0, textScale)
love.graphics.print("scale: {"..main_Player.sprite_scale.x..", "..main_Player.sprite_scale.y.."}",10*textScale,100*textScale, 0, textScale)
love.graphics.print("states: \"isOnGround\": "..tostring(main_Player.isOnGround),10*textScale,120*textScale, 0, textScale)
love.graphics.print("[Camera]",10*textScale,160*textScale, 0, textScale)
love.graphics.print("position: {"..Camera.pos.x..", "..Camera.pos.y.."}",10*textScale,180*textScale, 0, textScale)
love.graphics.print("size: {"..Camera.width..", "..Camera.height.."}",10*textScale,200*textScale, 0, textScale)
love.graphics.print(textScale,10*textScale,240*textScale, 0, textScale)
love.graphics.print("Level: "..levelNum.." / "..#levelList.." \""..currLevel.."\"",10*textScale,260*textScale, 0, textScale)
-- player isOnGroundCheck
love.graphics.setColor(1,0,0)
end
function DebugColisions()
LoadedObjects.DrawCollisions()
end
function DebugEntities()
for _, particle in pairs(LoadedParticles) do
-- draw center CYAN
love.graphics.setColor(0,1,1)
love.graphics.circle("fill", -Camera.pos.x + particle.pos.x, -Camera.pos.y + particle.pos.y, 1)
end
for _, enty in pairs(LoadedEntities) do
-- draw center GREEN
love.graphics.setColor(0,1,0)
love.graphics.circle("fill", -Camera.pos.x + enty.pos.x, -Camera.pos.y + enty.pos.y, 1)
-- draw collision box PURPLE
love.graphics.setColor(1,0,1)
love.graphics.rectangle(
"line",
-Camera.pos.x + enty.pos.x + enty.boxCollision.from.x,
-Camera.pos.y + enty.pos.y + enty.boxCollision.from.y,
-Camera.pos.x + enty.pos.x + enty.boxCollision.to.x -(-Camera.pos.x + enty.pos.x + enty.boxCollision.from.x),
-Camera.pos.y + enty.pos.y + enty.boxCollision.to.y -(-Camera.pos.y + enty.pos.y + enty.boxCollision.from.y)
)
end
end