summaryrefslogtreecommitdiff
path: root/Game/Selection/multi_select_area.gd
blob: 88e4f7f001a94f8778f7f7db8ec020f076da3b9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extends Area2D


signal select(nodes: Array)


func _ready() -> void:
	var camera: Camera = get_viewport().get_camera_2d()
	var camera_rect = camera.get_rect()
	
	global_position = camera_rect.position + camera_rect.size / 2
	
	$CollisionShape2D.shape.size = camera_rect.size


func _process(_delta: float) -> void:
	var nodes = get_overlapping_areas() + get_overlapping_bodies()
	if nodes.size() > 0:
		select.emit(nodes)
		queue_free()