How to add button in godot and print Hello World when click

 hi everyone today i will show you how to create button in godot and click button to print Hello world.

we will not waste time ok let's go


the first open project before create button



click Node2D

then this window will appear.
type button in search bar


click button

there is child in Node2d 

this button too small you can change size with scale mode 
or press button.




ok i am very satisfied for this button.


you can press f5 for test your button.
it'is look like button hahaha.
then we will add script for change scene


right click button and click Attach Script



click Create button




you will see this 




change to Node tab and click pressed() for create function when we click this button


typing print hello world in _on_pressed() function
then press f5 for testing


when click button


Hello world will appear in command when you click each time.




like this



thank you very much for reading my article i will upload article for help you basic how to in godot and so on 
bye bye.  
































ความคิดเห็น

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

How to click button count up in Godot

How to create button and click exit game in Godot

How to create animation in krita frame by frame for game