|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Ninjakrom |
extends Node2D
onready var Signal = $AnimationPlayer
func _process(_delta):
Signal.play(“KromCut_01”)
func _on_AnimationPlayer_animation_finished(_anim_name):
match _anim_name:
“KromCut_01”:
get_tree().call_deferred(“change_scene”, “res://assets/cutscene_01.tscn”)
I need help with this script in the cutscene that i working, is still loop over and over again and the problem is with signal.play and match _anim_name:
_process(delta)
loop runs continuously
ramazan | 2022-07-02 07:25
|
|
|
|
Reply From: |
Inces |
To clarify what ramazan meant :
if animation is played in process(), it is endlessly being started, so it is stuck at frame 0, and it never reaches end of the animation. Animation_finished
is never emitted.
You have to play your animation once. For example in ready()
or input(event)
I don’t know if i’m wrong but in the function i need to change “process” to ready() or input(event) ?
func ready():
Signal.play("KromCut_01")
func onAnimationPlayeranimationfinished(animname):
match animname:
"KromCut01":
gettree().calldeferred("changescene", "res://assets/cutscene_01.tscn")
Ninjakrom | 2022-07-04 20:54
What do You want to happen ?
If You want animation to start playing when project starts - You need to play(“Kromcut_01”) in ready(). If You also want animation to loop, just choose loop option in Animation player editor. It is actually a very small button, on the top right of animation menu.
If You want animation to start playing when an action is pressed, You need to move this line of code to input(event)