initial commit
This commit is contained in:
parent
3b5ca128ba
commit
538fea556d
5 changed files with 70 additions and 2 deletions
49
scenes.lua
Normal file
49
scenes.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue