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
-
2:06:16
TimcastIRL
6 hours agoTrump Calls For NUCLEAR OPTION, END Filibuster Over Food Stamp Crisis | Timcast IRL
132K67 -
3:58:54
SavageJayGatsby
4 hours ago🎃 Friend Friday – Halloween Edition! 👻🕷️
2.13K -
16:16
Robbi On The Record
12 days ago $13.14 earnedThe Dark History of Halloween | What You Should Know
48K36 -
58:18
Flyover Conservatives
22 hours agoThe Truth About Halloween that You DIDN’T Know - Holiday Special - Historian Bill Federer | FOC SPECIAL Show
7.94K1 -
Ellie_roe
3 hours agoEllie and Errys Halloween Spooktacular || Random Horror Games
778 -
50:27
Sarah Westall
4 hours agoBig Banks Caught Rigging Market, IMF tells World to “Buckle Up” w/ Andy Schectman
9.46K1 -
13:54
Degenerate Jay
11 hours ago5 Best Superhero Movies To Watch On Halloween
1.18K1 -
59:03
NAG Podcast
4 hours agoSarah Fields: BOLDTALK W/Angela Belcamino
1.77K2 -
1:21:41
Glenn Greenwald
7 hours agoGlenn Takes Your Questions: On the Argentina Bailout, Money in Politics, and More | SYSTEM UPDATE #541
63.4K37 -
3:10:08
Barry Cunningham
4 hours agoPRESIDENT TRUMP TO USE NUCLEAR OPTION? FOOD STAMPS END! | SHUTDOWN DAY 31
27.4K21