project/build/default/main/button.gui_scriptc
2025-08-27 01:05:31 +01:00

52 lines
No EOL
1.7 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

µ
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 level1prescreen")
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"