-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_levels.gui_script
More file actions
49 lines (43 loc) · 1.43 KB
/
Copy pathmenu_levels.gui_script
File metadata and controls
49 lines (43 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function init(self)
defglot.set_text(gui.get_node("levels"),"LEVELS")
defglot.autofit_text(gui.get_node("levels"),2)
self.complete_level=defsave.get("config", "complete")
msg.post(".", "acquire_input_focus")
for i=1, self.complete_level+1 do
local node=gui.get_node("level"..i)
gui.set_texture(node, "main")
gui.play_flipbook(node, "button (4)")
end
--msg.post("main:/loader#level"..complete_level+1,"load")
end
function final(self)
-- Add finalization code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
end
function update(self, dt)
-- Add update code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
end
function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") and sender.fragment==hash("level1") then
msg.post(sender, "acquire_input_focus") end
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
for i=1,self.complete_level+1 do
if gui.pick_node(gui.get_node("level"..i), action.x, action.y) then
msg.post("main:/loader#level"..i,"load")
msg.post("main:/loader#level"..i,"init")
msg.post("main:/loader#level"..i,"enable")
msg.post("main:/loader#menu","unload")
end
end
end
end
function on_reload(self)
-- Add reload-handling code here
-- Learn more: https://defold.com/manuals/hot-reload/
-- Remove this function if not needed
end