#i need help with animeted sprite

4 messages · Page 1 of 1 (latest)

winter portal
#

using Godot;
using System;
using System.Runtime.CompilerServices;

public partial class playerMove: CharacterBody2D
{

private AnimatedSprite2D _animatedSprite;

public override void _Ready()
{
    _animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
}

[Export] public float speed = 300f;

public override void _PhysicsProcess(double delta)
{
    Vector2 move_input = Input.GetVector("left", "right", "up", "down");
    
    Velocity = move_input * speed;

    MoveAndSlide();
}

}

#

movment

supple timber
#

https://docs.godotengine.org/en/4.2/tutorials/2d/2d_sprite_animation.html should provide some answers to what you're trying to accomplish there, basically you just need to tell your animated sprite to play the corresponding animation when the conditions for run/walk/idle are met