Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Snayk |
I want to put a animation for the fire ball when it touch any body, a animation of the fire dying but i don’t know how do this
This is the script of the fire ball:
OBS: The animation called “Off” is the dying fire animation
extends Area2D
const SPEED = 180
var velocity = Vector2()
var direction = 1
func _ready():
pass
func set_fireball_direction(dir):
direction = dir
if dir == -1:
$fire_sprite.flip_h = true
func _process(delta):
velocity.x = SPEED * delta * direction
translate(velocity)
$fire_sprite.play(“Fire”)
func _on_notifier_screen_exited():
queue_free()
func _on_Fire_body_entered(body):
$fire_sprite.play(“Off”)
func _on_fire_sprite_animation_finished():
queue_free()