33 lines
956 B
GDScript
33 lines
956 B
GDScript
extends Control
|
|
|
|
onready var player_settings = find_node("player_settings")
|
|
|
|
|
|
func _ready():
|
|
find_node("bots").set_pressed(config.get_value("game","bots", true))
|
|
find_node("bot_difficulty").set_value(config.get_value("game","bot_difficulty", gamestate.DEFAULT_BOT_DIFFICULTY))
|
|
find_node("bot_difficulty").set_editable(find_node("bots").is_pressed())
|
|
find_node("bot_difficulty").set_tooltip(tr("BOT_DIFFICULTY"))
|
|
|
|
|
|
func _draw():
|
|
find_node("start").grab_focus()
|
|
|
|
|
|
func _on_start_pressed():
|
|
var name = player_settings.get_name_node().text
|
|
var color = player_settings.get_color_node().color
|
|
var bots = find_node("bots").is_pressed()
|
|
var bot_difficulty = find_node("bot_difficulty").get_value()
|
|
queue_free()
|
|
server.local_game(name,color,bots,bot_difficulty)
|
|
|
|
|
|
func _on_back_pressed():
|
|
queue_free()
|
|
get_tree().get_root().get_node("main_menu").show()
|
|
|
|
|
|
func _on_bots_toggled(button_pressed):
|
|
find_node("bot_difficulty").set_editable(button_pressed)
|