49 lines
1.1 KiB
Lua
49 lines
1.1 KiB
Lua
scenes = {}
|
|
|
|
time_since_start = 0
|
|
loops = 0
|
|
main_scene = {}
|
|
looping_scene = {}
|
|
looping_scene.draw = function()
|
|
love.graphics.print("Loopdy loo", 110, 120)
|
|
end
|
|
looping_scene.update = function(dt)
|
|
time_since_start = time_since_start + dt
|
|
if time_since_start > 2 then
|
|
looping_scene.draw = function()
|
|
love.graphics.print("Looping continues", 200, 150)
|
|
end
|
|
end
|
|
if time_since_start > 8 then
|
|
time_since_start = 0
|
|
table.remove(scenes)
|
|
loops = loops + 1
|
|
end
|
|
end
|
|
|
|
main_scene.update = function(dt)
|
|
time_since_start = time_since_start + dt
|
|
if time_since_start > 2 then
|
|
main_scene.draw = function()
|
|
love.graphics.print("Main Scene extended", 400, 300)
|
|
end
|
|
end
|
|
if time_since_start > 6 then
|
|
time_since_start = 0
|
|
if loops < 4 then
|
|
table.insert(scenes, looping_scene)
|
|
else
|
|
main_scene.draw = function()
|
|
love.graphics.print("Damn, enough with the looping..", 100, 100)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
main_scene.draw = function()
|
|
love.graphics.print("Main Scene", 400, 300)
|
|
end
|
|
|
|
table.insert(scenes, main_scene)
|
|
|
|
return scenes
|