Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BlackByson |
I created a target in Godot that has a CollisionShape2d and an Area2D. I have it set up to queue_free() when you click on it with the mouse
func _on_Area2D_input_event(_viewport, event, _shape_idx):
if event is InputEventMouseButton:
if Input.is_action_pressed("ui_click"):
# don't want it to play every time we click
if (play_once == 0):
# coroutine keeps queue_free() from happening before sound is over
yield(play_sound(), "finished")
play_once = 1
emit_signal("target_hit")
queue_free()
when I create a scene with just the target in it I can click anywhere in the Area2D and it will disappear as expected. But when I added it to my level one scene it only appears to respond to clicks when I click directly in the center of the target. I’m unsure what is causing this behavior. I have a few of the way it looks when I start the scene, and how the target node was created. Does anyone know why this might be happening?
Your screenshot link is broken.
kidscancode | 2020-03-21 19:22