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

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.

主站蜘蛛池模板: 会宁县| 五寨县| 玛沁县| 镇赉县| 台山市| 娱乐| 黄平县| 镇赉县| 襄汾县| 唐海县| 汪清县| 高密市| 白朗县| 武冈市| 榕江县| 樟树市| 二连浩特市| 花莲市| 八宿县| 师宗县| 哈巴河县| 黄骅市| 承德县| 霍州市| 墨脱县| 定陶县| 东城区| 元谋县| 砀山县| 东安县| 抚宁县| 资中县| 依兰县| 洛隆县| 遂宁市| 平凉市| 宁河县| 九江县| 彭州市| 定边县| 苗栗市|