template v1
This commit is contained in:
parent
bf9d8e8b03
commit
4b2eedeb49
67
games/template.p8
Normal file
67
games/template.p8
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
--
|
||||||
|
function _init()
|
||||||
|
start_scene("title")
|
||||||
|
end
|
||||||
|
|
||||||
|
function _update()
|
||||||
|
if _scene and _scene.update then
|
||||||
|
_scene.update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _draw()
|
||||||
|
if _scene and _scene.draw then
|
||||||
|
_scene.draw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function start_scene(name)
|
||||||
|
_scene = _scenes[name]
|
||||||
|
_scene_start = time()
|
||||||
|
if _scene.start then
|
||||||
|
_scene.start()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene_time()
|
||||||
|
return time() - _scene_start
|
||||||
|
end
|
||||||
|
|
||||||
|
_scene = nil
|
||||||
|
_scenes = {}
|
||||||
|
_scene_start = 0
|
||||||
|
|
||||||
|
function draw_title()
|
||||||
|
cls()
|
||||||
|
print("title " .. scene_time())
|
||||||
|
end
|
||||||
|
|
||||||
|
function update_title()
|
||||||
|
if scene_time() > 2 then
|
||||||
|
start_scene("menu")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
_scenes.title = {start=nil, draw=draw_title, update=update_title}
|
||||||
|
|
||||||
|
function draw_menu()
|
||||||
|
cls()
|
||||||
|
print("menu " .. scene_time())
|
||||||
|
end
|
||||||
|
|
||||||
|
function update_menu()
|
||||||
|
end
|
||||||
|
|
||||||
|
_scenes.menu = {start=nil, draw=draw_menu, update=nil}
|
||||||
|
|
||||||
|
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
Loading…
Reference in New Issue
Block a user