bullet.gd 262 B

12345678910111213
  1. class_name Bullet extends RigidBody2D
  2. @onready var animation_player := $AnimationPlayer as AnimationPlayer
  3. func destroy() -> void:
  4. animation_player.play(&"destroy")
  5. func _on_body_entered(body: Node) -> void:
  6. if body is Enemy:
  7. (body as Enemy).destroy()