summaryrefslogtreecommitdiff
path: root/Units/blocker.gd
blob: e9c09e01a9596735f3d79763a669c682b3342613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extends Unit


func _ready():
	$AnimatedSprite.play("block")


func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
	if event.is_action_pressed("select") and Game.selected_unit_type:
		get_viewport().set_input_as_handled()
		
		var unit = Game.selected_unit_type.instantiate()
		unit.position = global_position
		
		get_tree().current_scene.add_child(unit)
		queue_free()