blob: e6238747fb6fdc01d003b59e5f51d86642aa39c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
extends TextureButton
@export var texture: Texture2D
func _on_pressed() -> void:
var unit = preload("res://Units/Unit.tscn").instantiate() as Unit
if texture:
unit.get_node("Sprite2D").texture = texture
unit.get_node("Sprite2D").scale = Vector2(32,32) / texture.get_size()
Client.spawn_unit(unit, Client.stage.spawn)
|