Game2-FullBallScript

 avatar
TaktycznyBocian
plain_text
2 years ago
533 B
5
Indexable
extends RigidBody2D

func _physics_process(_delta):
	var bodies = get_colliding_bodies()
	for body in bodies:
		if body.is_in_group("Brick"):
			body.get_node("CPUParticles2D").set_visible(true)
			body.get_node("CPUParticles2D").set_emitting(true)
			body.get_node("Sprite").queue_free()
			body.get_node("CollisionShape2D").queue_free()
			body.get_node("Timer").start()
			body.get_node("Audio").play()
			get_node('/root/Level/GameLabel').score += 1


func _on_Ball_body_entered(body):
	get_node("Audio").play()
Editor is loading...