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
-
1:06:42
The White House
2 hours agoPresident Trump Delivers Remarks at Navy 250 Celebration
11.1K20 -
3:22:43
Barry Cunningham
3 hours agoBREAKING NEWS: PRESIDENT TRUMP GIVES SPEECH TO THE NAVY!
45.9K26 -
4:37:33
MattMorseTV
5 hours ago $77.95 earned🔴Trump's MAJOR ANNOUNCEMENT.🔴
68.3K141 -
LIVE
GritsGG
3 hours agoWarzone Win Grinding! Most Wins in WORLD! 3680+!
129 watching -
1:10:51
Jeff Ahern
3 hours ago $2.59 earnedThe Sunday show with Jeff Ahern
14.4K3 -
LIVE
Putther
4 hours ago $0.88 earned🔴LAZY SUNDAY BOUNTY HUNTING ON GTA !!
133 watching -
2:31:44
BBQPenguin_
2 hours agoThis is one of the BEST FREE TO PLAY Games!
7.67K -
1:14:12
Sports Wars
6 hours agoMark Sanchez STABBED And Arrested, Bill Belichick DISASTER, MLB Playoffs, NFL Week 5
42.4K2 -
1:30:58
Lara Logan
2 days agoENEMY AT THE GATES: Trevor Loudon Unmasks the Sinister Alliance Working to Destroy America | Ep 38
47.6K71 -
LIVE
NeoX5
4 hours agoCastlevania: Dawn of Sorrow | Part 1 | First Playthrough | Rumble Gaming
38 watching