fixes
This commit is contained in:
parent
cffc458f0a
commit
1e2c549df0
21
Map.gd
21
Map.gd
@ -53,18 +53,15 @@ func spawn(pos,vol):
|
||||
for result in results:
|
||||
result.collider.queue_free()
|
||||
if tool.name=="Control":
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
var query_params = PhysicsPointQueryParameters2D.new()
|
||||
query_params.position = pos
|
||||
query_params.collide_with_areas = true # Set to false if you only want to check collision with bodies
|
||||
query_params.collide_with_bodies = true # Set to false if you only want to check collision with areas
|
||||
query_params.collision_mask = 1 # players
|
||||
|
||||
var results = space_state.intersect_point(query_params, 32) # Adjust max_results as needed
|
||||
for result in results:
|
||||
controlling=result.collider
|
||||
print("gotit")
|
||||
break
|
||||
var closest_node = null
|
||||
var min_distance = INF # Infinite distance initially
|
||||
for node in %Map.get_children():
|
||||
if node is Player:
|
||||
var distance = pos.distance_to(node.global_position)
|
||||
if distance < min_distance:
|
||||
min_distance = distance
|
||||
closest_node = node
|
||||
controlling=closest_node
|
||||
|
||||
func spawm_pool(pos,red,green,blue):
|
||||
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
||||
|
@ -11,7 +11,9 @@ func _ready():
|
||||
first_child = false # Set flag to false after processing the first child
|
||||
|
||||
func populate_paste():
|
||||
var current_selection = $VBoxContainer/Paste.get_item_text($VBoxContainer/Paste.selected)
|
||||
var current_selection = null
|
||||
if $VBoxContainer/Paste.selected >= 0 and $VBoxContainer/Paste.selected < $VBoxContainer/Paste.get_item_count():
|
||||
current_selection = $VBoxContainer/Paste.get_item_text($VBoxContainer/Paste.selected)
|
||||
|
||||
$VBoxContainer/Paste.clear()
|
||||
var dir = DirAccess.open("user://saves/")
|
||||
|
Loading…
Reference in New Issue
Block a user