The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes
extends Node2D

onready var Signal = $AnimationPlayer

func process(delta):
Signal.play("KromCut_01")

func onAnimationPlayeranimationfinished(animname):
match animname:
"KromCut01":
get
tree().calldeferred("changescene", "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 animname:

Preview Image
https://imgur.com/HUV13jn

Godot version 3.5 rc5
in Engine by (20 points)

_process(delta)
loop runs continuously

1 Answer

0 votes

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)

by (8,188 points)

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")

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)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.