0 votes

extends KinematicBody2D

export(int) var speed = 80.0

onready var animationplayer = $AnimationPlayer

func process(delta):
if Input.isactionpressed("uileft"):

func physicsprocess(delta):
var velocity = Vector2.ZERO
if Input.isactionpressed("uiright"):
velocity.x += 1.0
if Input.is
velocity.x -= 1.0
if Input.isactionpressed("uidown"):
velocity.y += 1.0
if Input.is
velocity.y -= 1.0

move_and_slide(velocity * speed)
Godot version v3.4.4
in Engine by (14 points)
edited by

1 Answer

0 votes

You could check whether the velocity is zero and then start the idle animation.

by (18 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.