initial commit
This commit is contained in:
parent
3b5ca128ba
commit
538fea556d
5 changed files with 70 additions and 2 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"editor.formatOnSave": true
|
||||
}
|
5
conf.lua
Normal file
5
conf.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
function love.conf(t)
|
||||
t.window.width = 640
|
||||
t.window.height = 480
|
||||
t.window.title = "Datix"
|
||||
end
|
12
main.lua
12
main.lua
|
@ -1,3 +1,11 @@
|
|||
function love.draw()
|
||||
love.graphics.print("Hello World", 400, 300)
|
||||
require "scenes"
|
||||
function love.load()
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
scenes[#scenes].update(dt)
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
scenes[#scenes].draw()
|
||||
end
|
||||
|
|
3
readme.md
Normal file
3
readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Game
|
||||
|
||||
Let's see where this goes.
|
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