官术网_书友最值得收藏!

Using buttons

Add a Button node and change its name to StartButtonThis button will be displayed before the game starts, and when clicked, it will hide itself and send a signal to the Main scene to start the game. Set the Text property to Start and change the custom font like you did with the MessageLabel. In the Layout menu, choose Center Bottom. This will put the button at the very bottom of the screen, so move it up a little bit either by pressing the Up arrow key or by editing the margins and setting Top to -150 and Bottom to -50

When a button is clicked, a signal is sent out. In the Node tab for the StartButton, connect the pressed() signal:

func _on_StartButton_pressed():
$StartButton.hide()
$MessageLabel.hide()
emit_signal("start_game")

The HUD emits the start_game signal to notify Main that it's time to start a new game.

主站蜘蛛池模板: 犍为县| 天柱县| 呼和浩特市| 凤山市| 瓮安县| 孟津县| 佳木斯市| 贺兰县| 华容县| 柏乡县| 虎林市| 甘南县| 平利县| 凌源市| 罗源县| 镇巴县| 盐津县| 六盘水市| 阳朔县| 都匀市| 改则县| 曲阳县| 滕州市| 河曲县| 汤原县| 连平县| 平原县| 青铜峡市| 育儿| 报价| 库尔勒市| 黎城县| 安徽省| 兴山县| 灵宝市| 宁德市| 广安市| 西林县| 略阳县| 隆子县| 无极县|