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

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.

主站蜘蛛池模板: 个旧市| 宁武县| 山东省| 和田市| 绥化市| 常熟市| 郯城县| 平度市| 德安县| 监利县| 阿拉善盟| 绥芬河市| 灵石县| 泽普县| 页游| 建水县| 鱼台县| 东兰县| 扶风县| 资中县| 泌阳县| 浑源县| 改则县| 灵璧县| 东至县| 平顶山市| 阿拉善左旗| 锦州市| 建瓯市| 都兰县| 博兴县| 水城县| 阳泉市| 安图县| 兴隆县| 武穴市| 淅川县| 且末县| 滁州市| 内乡县| 泗水县|