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:
|
for result in results:
|
||||||
result.collider.queue_free()
|
result.collider.queue_free()
|
||||||
if tool.name=="Control":
|
if tool.name=="Control":
|
||||||
var space_state = get_world_2d().direct_space_state
|
var closest_node = null
|
||||||
var query_params = PhysicsPointQueryParameters2D.new()
|
var min_distance = INF # Infinite distance initially
|
||||||
query_params.position = pos
|
for node in %Map.get_children():
|
||||||
query_params.collide_with_areas = true # Set to false if you only want to check collision with bodies
|
if node is Player:
|
||||||
query_params.collide_with_bodies = true # Set to false if you only want to check collision with areas
|
var distance = pos.distance_to(node.global_position)
|
||||||
query_params.collision_mask = 1 # players
|
if distance < min_distance:
|
||||||
|
min_distance = distance
|
||||||
var results = space_state.intersect_point(query_params, 32) # Adjust max_results as needed
|
closest_node = node
|
||||||
for result in results:
|
controlling=closest_node
|
||||||
controlling=result.collider
|
|
||||||
print("gotit")
|
|
||||||
break
|
|
||||||
|
|
||||||
func spawm_pool(pos,red,green,blue):
|
func spawm_pool(pos,red,green,blue):
|
||||||
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
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
|
first_child = false # Set flag to false after processing the first child
|
||||||
|
|
||||||
func populate_paste():
|
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()
|
$VBoxContainer/Paste.clear()
|
||||||
var dir = DirAccess.open("user://saves/")
|
var dir = DirAccess.open("user://saves/")
|
||||||
|
Loading…
Reference in New Issue
Block a user