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
-
8:33
SKAP ATTACK
15 hours ago $0.02 earnedWhat Went Wrong With the Nuggets
6361 -
23:51
JasminLaine
14 hours agoCBC STUNNED Into Silence as Carney PANICS—Defends Bill C-69 and His Foreign Profits
1.82K15 -
17:25
World2Briggs
11 hours ago $0.01 earnedThe Dark Reality Of Human Trafficking In The United States
1.29K4 -
4:31
Mrgunsngear
13 hours ago $1.91 earnedBreaking: Kash Patel No Longer ATF Director! Replacement Has Been Named
5.23K6 -
43:42
Esports Awards
21 hours agoAustinJohnPlays on Pokémon Card Collection & Evolution of YouTube | Origins Podcast #2
1.53K -
59:35
Trumpet Daily
19 hours ago $3.72 earnedStrongman Stare Down - Trumpet Daily | Apr. 9, 2025
4.71K4 -
2:50:22
TimcastIRL
11 hours agoTrump Hits China With 125% Tariff, Pauses Others, Sees LARGEST Market Rally IN HISTORY | Timcast IRL
369K232 -
1:43:15
Glenn Greenwald
14 hours agoTrump's Tariffs: A Threat to the Neoliberal Order? With Journalist David Sirota; Biden CBP Fabricated Doc to Help Imprison Bolsonaro Adviser? Plus: Israel Support Collapsing | SYSTEM UPDATE #436
212K119 -
15:04
T-SPLY
16 hours agoMSNBC Accuses Trump Of "Snatching" Illegal Immigrants For Political Show
98.3K42 -
2:01:37
Melonie Mac
16 hours agoGo Boom Live Ep 44!
139K39