I want to finish up this Breakout Clone I made a few months back and I need a good script to add/improve to make the ball break bricks upon collision.
#I need help finishing up a Breakout Clone I made by having the balls collide with the bricks.
9 messages · Page 1 of 1 (latest)
you should use the physics bodies (CharacterBody, StaticBody) as root nodes of your scenes, first of all. Get rid of those Node2Ds and attach the script to the physics bodies.
you can add this as line 2 in your brick.gd class_name Brick
and then this in ball.gd at line 14 inside the if block
if collision.get_collider() is Brick:
collision.get_collider().hit()
or even better remove the script on your bricks completely and just do
if collision.get_collider() is Brick:
collision.get_collider().queue_free()
let me know if it doesnt work or you need some more detailed explanation