Mothback/data/scripts/game.lua

63 lines
1.3 KiB
Lua
Raw Normal View History

function GameStep()
if not do_pause then
SetCollisionFlags(main_Player)
for _, particle in pairs(LoadedParticles) do
particle:Smart()
particle:DoPhysics()
end
for _, enty in pairs(LoadedEntities) do
enty:Smart()
enty:DoPhysics()
end
AnimateTiles()
Camera:positionCenterAt(main_Player.pos.x, main_Player.pos.y)
--camera:positionAt(main_Player.pos.x, main_Player.pos.y,game.width,game.height)
end
2022-01-30 10:31:18 +00:00
if Keybind:HasPressed(Keybind.debug.debug) then
if debug then
debug = false
debug_collision = true
elseif debug_collision then
debug_collision = false
else
debug = true
end
end
if Keybind:HasPressed(Keybind.debug.reposition) then
if not editor_mode then
main_Player.pos.x, main_Player.pos.y = 16,-10
end
end
if Keybind:HasPressed(Keybind.debug.reload) then
LoadLevel()
end
if Keybind:HasPressed(Keybind.debug.editor) then
editor_mode = true
end
end
function GameDraw()
GameworldDrawPrepare()
GameworldDrawParticles()
GameworldDrawBackground()
GameworldDrawEntities()
GameworldDrawForeground()
GameworldDrawEnd()
GameworldDrawLighting()
-- hud
textScale = 0.5
-- debug
if debug then DebugUI() end
if debug_collision then
DebugColisions()
DebugEntities()
end
end