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
Major League Fishing
5 days agoLIVE! - Fishing Clash Team Series: Heritage Cup - Day 2
774 watching -
10:31
Dr. Eric Berg
2 hours ago13 Foods You Should Never Buy Organic
8.83K10 -
15:10
SB Mowing
1 month agoShe had TEARS OF JOY on her face - An update on Beth
8.34K31 -
LIVE
Lofi Girl
3 years agolofi hip hop radio 📚 - beats to relax/study to
195 watching -
LIVE
Nikko Ortiz
2 hours agoLIVE - Trying Rumble Studio!
205 watching -
9:30
Sugar Spun Run
5 hours agoBlack and White Cookies
31K1 -
2:45
SLS - Street League Skateboarding
4 days agoManny Santiago's 'THIS IS 40' Part
18.3K2 -
6:40
Homesteading Family
5 days agoNever Make Pie Crust From Scratch Again (Do THIS Instead)
14.2K2 -
44:20
Melissa K Norris
3 days ago $0.30 earnedThe Most Overlooked Way to Preserve Food for Months (No Freezer Needed) w/ Sam Knapp
10K1 -
23:00
Tony Jeffries
6 days agoThe Best & Worst Boxing Training Methods (Ranked by Olympic Boxer)
7.06K