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
BonginoReport
1 hour agoNicki Minaj Speaks Out Against Christian Persecution - Nightly Scroll w/ Hayley Caronia (Ep.169)
2,123 watching -
LIVE
Kim Iversen
2 hours agoTrump’s Nigeria Threat Isn’t About Christians — It’s About China
5,248 watching -
LIVE
Sean Unpaved
1 hour agoDodgers Dynasty Rolls On, NFL Chaos Reigns, & MNF Showdown Countdown
74 watching -
1:35:56
Redacted News
2 hours agoA MAGA Civil War has just begun, Christians slaughtered in Nigeria, Charlie Kirk's audiit | Redacted
85.5K99 -
LIVE
Dr Disrespect
7 hours ago🔴LIVE - DR DISRESPECT - ARC RAIDERS - FULL SEND INTO THE RED
1,686 watching -
26:34
Stephen Gardner
2 hours ago🔥Elon EXPOSES The Exact Blueprint Dems use to CHEAT on Joe Rogan!!
16.8K64 -
51:10
Dad Saves America
6 hours ago $0.36 earnedMask Off Mamdani: NYC’s Socialist “Savior” Is Another Spoiled Aristocrat
3.63K2 -
6:14
Buddy Brown
7 hours ago $1.61 earnedLaw Enforcement Caught SNOOPING on PRIVATE LAND! | Buddy Brown
4.66K11 -
16:21
Real Estate
1 month ago $0.28 earnedIt’s Not Just You..NO ONE CAN AFFORD KIDS ANYMORE
3.99K6 -
LIVE
LFA TV
1 day agoLIVE & BREAKING NEWS! | MONDAY 11/3/25
1,032 watching