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

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.

主站蜘蛛池模板: 和政县| 苍溪县| 台中县| 望奎县| 德昌县| 定安县| 若羌县| 绥中县| 吴江市| 仪征市| 漯河市| 凤城市| 库伦旗| 当雄县| 民权县| 上虞市| 武定县| 墨竹工卡县| 赤壁市| 内乡县| 和政县| 长子县| 蛟河市| 来宾市| 尚义县| 博野县| 佳木斯市| 徐水县| 太康县| 青阳县| 嵊州市| 仁怀市| 会同县| 陇川县| 隆子县| 大方县| 凉城县| 陕西省| 镇安县| 赫章县| 敦化市|