now there are spawn objects! now entity spawns are loaded from level! now entity spawns are saved to level!
100 lines
1.9 KiB
Lua
100 lines
1.9 KiB
Lua
function stepGame()
|
|
setCollisionFlags()
|
|
if menu_type == "no" then
|
|
for _, particle in pairs(LoadedObjects.Particles) do
|
|
particle:doLogic()
|
|
end
|
|
for _, enty in pairs(LoadedObjects.Entities) do
|
|
enty:doLogic()
|
|
end
|
|
end
|
|
|
|
for _, particle in pairs(LoadedObjects.Particles) do
|
|
particle:doPhysics()
|
|
end
|
|
for _, enty in pairs(LoadedObjects.Entities) do
|
|
enty:doPhysics()
|
|
end
|
|
|
|
animateTiles()
|
|
Camera:followPlayer(main_player)
|
|
--Camera:positionCenterAt(main_player.pos.x, main_player.pos.y)
|
|
--camera:positionAt(main_player.pos.x, main_player.pos.y,game.width,game.height)
|
|
|
|
if Keybind:checkPressed(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:checkPressed(Keybind.debug.reposition) then
|
|
if not editor_mode then
|
|
main_player.pos.x, main_player.pos.y = 16,-10
|
|
end
|
|
end
|
|
|
|
if Keybind:checkPressed(Keybind.debug.reload) then
|
|
clearMenu()
|
|
menu_type = "dialog"
|
|
initMenu("dialog",dialog_sequence.example)
|
|
end
|
|
|
|
if Keybind:checkPressed(Keybind.debug.editor) then
|
|
editor_mode = true
|
|
end
|
|
|
|
if Keybind:checkPressed(Keybind.debug.recording) then
|
|
if DemoRecording then
|
|
Demo:endRecord()
|
|
else
|
|
Demo:startRecord()
|
|
end
|
|
end
|
|
|
|
if Keybind:checkPressed(Keybind.debug.playback) then
|
|
if DemoPlayback then
|
|
Demo:endPlayback()
|
|
else
|
|
Demo:startPlayback()
|
|
end
|
|
end
|
|
end
|
|
|
|
function drawGame()
|
|
|
|
-- prepare
|
|
startGameworldDraw()
|
|
updateGameWorldLights()
|
|
|
|
-- background
|
|
drawGameworldBackground()
|
|
drawGameworldLights()
|
|
drawGameworldEntitiesBackground()
|
|
|
|
-- foreground
|
|
drawGameworldForeground()
|
|
drawGameworldParticles()
|
|
drawGameworldEntities()
|
|
|
|
if LevelData.properties.darkness then
|
|
drawGameworldDarkness()
|
|
end
|
|
-- end
|
|
endGameworldDraw()
|
|
|
|
-- hud
|
|
text_size = 1
|
|
|
|
-- debug
|
|
if debug then debugUI() end
|
|
if debug_collision then
|
|
debugColisions()
|
|
debugEntities()
|
|
end
|
|
end
|