I have been trying to make a breakout style game, currectly the player and the ball works just fine, and i can also detect the block that the ball touches, but i cant delete it.
The blocks have a foundation of:
- StaticBody2D
-- CollisionShape2D
-- Sprite
and the ball has a foundation of:
- KineticBody2D
-- ColisionShape2D
-- Sprite
and heres the balls _physics_progress(delta): code thats used to check collision:
func _physics_process(delta):
var collision_object = move_and_collide(velocity * speed * delta)
if collision_object:
velocity = velocity.bounce(collision_object.normal)
if collision_object.collider.is_in_group("Destroyable"):
pass ## Delete the destroyable that it touches, and bounce off like normal
i can detect what node it touches via print (collision_object.collider.name)
, but i cant delete that specific instance of node/cant fit in queue.free in there for that specific node for it to get rid of it, how can i do that?