Premium Only Content
Button GUI with Scene Transition #defold
Creating a Button for any GUI in Defold plus adding some functionality with switching to a new scene.
As promised: Code for each script used in video
----------Code Snippet----------
loader.script
local function show(self, proxy)
if self.current_proxy then
msg.post(self.current_proxy, "unload")
self.current_proxy = nil
end
msg.post(proxy, "async_load")
end
function init(self)
msg.post(".", "acquire_input_focus")
self.current_proxy = nil
msg.post("#", "show_game_over")
end
function on_message(self, message_id, message, sender)
if message_id == hash("show_game_over") then
show(self, "#game_over")
elseif message_id == hash("show_main") then
show(self, "#main")
elseif message_id == hash("proxy_loaded") then
self.current_proxy = sender
msg.post(sender, "enable")
end
end
~loader.script
game_over.gui_script
function init(self)
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
local button = gui.get_node("button")
if gui.pick_node(button, action.x, action.y) then
msg.post("00000:/loader#loader", "show_main")
print("button clicked!")
end
end
end
~game_over.gui_script
-----------Code Snippet----------
--
Subscribe to the Channel for more content, Like the video, Share the video, and Comment suggestions or to show your support!!!
Provide Thoughts on the channel and join the email list - https://bit.ly/3hG99wP
Check out my Social Media to reach out to me!
Twitter - https://twitter.com/vigmu2
Discord - https://discord.gg/AYEAK5RmFR
To check out my Podcast - https://anchor.fm/vigmu2-games
New shows uploaded every Friday at 8AM (until further notice)
If you would like to donate for my current work and for further content! You can donate here -- https://bit.ly/3ea8q3u
-
LIVE
X22 Report
1 hour agoMr & Mrs X - The Food Industry Is Trying To Pull A Fast One On RFK Jr (MAHA), This Will Fail - EP 14
1,191 watching -
LIVE
Wendy Bell Radio
4 hours agoPet Talk With The Pet Doc
924 watching -
30:58
SouthernbelleReacts
2 days agoWe Didn’t Expect That Ending… ‘Welcome to Derry’ S1 E1 Reaction
2.51K -
13:51
True Crime | Unsolved Cases | Mysterious Stories
4 days ago $0.15 earned7 Real Life Heroes Caught on Camera (Remastered Audio)
5K -
LIVE
Total Horse Channel
10 hours ago2025 IRCHA Derby & Horse Show - November 1st
33 watching -
4:19
PistonPop-TV
6 days agoThe 4E-FTE: Toyota’s Smallest Turbo Monster
3.08K -
43:07
WanderingWithWine
5 days ago $0.04 earned5 Dreamy Italian Houses You Can Own Now! Homes for Sale in Italy
3.68K2 -
LIVE
Spartan
19 hours agoFirst playthrough of First Berserker Khazan
284 watching -
28:01
Living Your Wellness Life
2 days agoTrain Your Hormones
6.54K -
43:28
The Heidi St. John Podcast
1 day agoFan Mail Friday: Faith Over Fear and Finding Strength in Every Season
3.46K