extends Area2D var velocity = Vector2(0, 0) var rot_velocity = 0 var explosion = preload('res://Scenes/explosion.tscn') var pop = preload("res://Sounds/Explosion.wav") func _ready() -> void: connect("body_entered", _on_body_entered) func _physics_process(delta): position += velocity * delta rotation += rot_velocity * delta Utils.wrap_position(self) func _on_body_entered(body): if body.name == "Ship" and body.hit(): queue_free() func hit(): Utils.play_sound(pop, get_parent()) var boom = explosion.instantiate() boom.position = global_position boom.scale = scale get_parent().add_child(boom) Game.set_score(Game.score + 100) queue_free()