52 lines
No EOL
1.7 KiB
Text
52 lines
No EOL
1.7 KiB
Text
|
||
³
|
||
—
|
||
function init(self)
|
||
msg.post(".", "acquire_input_focus")
|
||
gui.set_alpha(gui.get_node("button_level1_highlight"), 0)
|
||
gui.set_alpha(gui.get_node("button_scoreboard_highlight"), 0)
|
||
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)
|
||
|
||
end
|
||
|
||
function on_message(self, message_id, message, sender)
|
||
-- Add message-handling code here
|
||
-- Learn more: https://defold.com/manuals/message-passing/
|
||
-- Remove this function if not needed
|
||
end
|
||
|
||
function on_input(self, action_id, action)
|
||
if action_id == hash("touch") and action.pressed then
|
||
if gui.pick_node(gui.get_node("button_level1"), action.x, action.y) then
|
||
msg.post("main:/controller#main", "show level1 screen")
|
||
elseif gui.pick_node(gui.get_node("button_scoreboard"), action.x, action.y) then
|
||
msg.post("main:/controller#main", "show scoreboard screen")
|
||
end
|
||
elseif action_id == nil then
|
||
--Check if mouse is over the button
|
||
if gui.pick_node(gui.get_node("button_level1"), action.x, action.y) then
|
||
gui.set_alpha(gui.get_node("button_level1_highlight"), 1) -- Show highlight
|
||
else
|
||
gui.set_alpha(gui.get_node("button_level1_highlight"), 0) -- Hide highlight
|
||
end
|
||
if gui.pick_node(gui.get_node("button_scoreboard"), action.x, action.y) then
|
||
gui.set_alpha(gui.get_node("button_scoreboard_highlight"), 1) -- Show highlight
|
||
else
|
||
gui.set_alpha(gui.get_node("button_scoreboard_highlight"), 0) -- Hide highlight
|
||
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
|
||
@main/button.gui_script" |