How to create button and click exit game in Godot

 

Hi everyone to day we will show you about how to create cutton and click exit game in godot

ok let's go

.

open your project first



create root tree i will use 2D scene


right click Node2d



choose Add Child Node


type button in search bar then choose Button


change size button up to you



type text for showing text in button

after that we will attach script for exit game


right click Node2D choose attach script


then press create




left click button once


click Node


choose pressed() for create function when press button will create some script we wiill create exit game when pressed .



Click create.





add get_tree().quit() in this function


and save scene


click save


select current



press f5 for test



ok it's work now when we click button game willl exit.


thank you very much for reading my article

























 


























ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

How to Export Window Desktop game in godot

How to create animation in krita frame by frame for game