49 lines
1.1 KiB
GDScript
49 lines
1.1 KiB
GDScript
extends Control
|
|
|
|
@onready
|
|
var points := $HBoxContainer/Points
|
|
|
|
@onready
|
|
var add := $HBoxContainer/AddPoint
|
|
|
|
@onready
|
|
var minus := $HBoxContainer/RemovePoint
|
|
|
|
@onready
|
|
var character := $HBoxContainer/Character
|
|
|
|
signal change_character_clicked
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
print("_ready")
|
|
add.pressed.connect(add_point)
|
|
minus.pressed.connect(minus_point)
|
|
character.pressed.connect(change_character)
|
|
|
|
func add_point():
|
|
var value := int(points.text)
|
|
points.text = str(value + 1)
|
|
|
|
func minus_point():
|
|
var value := int(points.text)
|
|
points.text = str(value - 1)
|
|
|
|
func change_character():
|
|
print("change_character")
|
|
change_character_clicked.emit()
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|
|
|
|
func _on_control_character_selected_clicked(file_name: String):
|
|
print("Back in player list with: " + file_name)
|
|
|
|
var texture = load("res://characters/" + file_name)
|
|
character.custom_minimum_size = Vector2(80, 40)
|
|
character.ignore_texture_size = true
|
|
character.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT
|
|
character.texture_normal = texture
|