added fireballs
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends RigidBody2D
|
||||
@onready var animated_sprite_2d = $AnimatedSprite2D
|
||||
@export var hit_object:PackedScene
|
||||
|
||||
var destroyed = false
|
||||
|
||||
func _ready():
|
||||
animated_sprite_2d.play("idle")#
|
||||
|
||||
func _on_activate_body_entered(body):
|
||||
if destroyed:
|
||||
return
|
||||
|
||||
destroyed = true
|
||||
animated_sprite_2d.play("destroy")
|
||||
|
||||
if hit_object == null:
|
||||
return
|
||||
|
||||
var instance = hit_object.instantiate()
|
||||
add_child(instance)
|
||||
instance.position.y -= 16
|
||||
Reference in New Issue
Block a user