0 votes

Hi, I'm a beginner with Godot.

I've just finished following UmaiPixel's Platformer Tutorial. I wanted to add a second attack, which is a stationary melee slash as opposed to a fireball projectile as shown in the tutorial.

In order to shorten the work time, I've duplicated the Fireball scene from said tutorial and adjusted it accordingly; same goes for the fireball attack code within the Player.

The desired effect is when I press the 'slash' attack button, utilizing the AnimationPlayer node, the slash animation will play, then once its finished, the attack as a whole will be 'queue-freed.'

The issue I've come across is that although the attack is 'queue-freed' once the animation is finished, the animation itself plays way too fast in-game, almost like within a split-second.

Originally I thought that the duration of '0.4' was the issue, so then I went and modified it to 1 second, and yet it still results in playing the animation way too fast in-game.

Here's the code:

extends Area2D

var velocity = Vector2()
var direction = 1

func setslashdirection(dir):
direction = dir
if dir == -1:
$Sprite.flip_h = true

func physicsprocess(delta):
velocity.x = delta * direction

func onSlashbodyentered(body):
if "Enemy" in body.name:

func onAnimationPlayeranimationfinished(animname):

Godot version Godot Engine v3.2.1
in Engine by (12 points)

1 Answer

+1 vote

AnimationPlayer has a play_back_speed which you can use to slow down the animation.
1 is original speed, .5 half and so on.

by (1,987 points)
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.