0 votes

extends KinematicBody2D
export var spe = 150
var move1 = Vector2.ZERO

func _ready():
$AnimationTree.active = true

func physicsprocess(delta):
var move1 = Vector2.ZERO
if Input.is
actionpressed("uileft"):
move1.x -= 1
move1.y = 0

if Input.is_action_pressed("ui_right"):
    move1.x += 1
    move1.y = 0 

if Input.is_action_pressed("ui_down"):
    move1.x = 0
    move1.y += 1

if Input.is_action_pressed("ui_up"):
    move1.x = 0
    move1.y -= 1

move1 = move1.normalized()

if move1 == Vector2.ZERO:
    $AnimationTree.get("parameters/playback").travel("Stay")

else:
    $AnimationTree.get("parameters/playback").travel("Move")
    $AnimationTree.set("parameters/Stay/blend_position",move1)
    $AnimationTree.set("parameters/Move/blend_position",move1)
    move_and_slide(move1 * spe  )
in Engine by (14 points)

1 Answer

0 votes

In another post I read somebody solved this by exchanging:

$AnimationTree.set("parameters/Stay/blend_position",move1)

By:

$AnimationTree["parameters/Stay/blend_position"]=move1

Idk why as it should be the same.

by (124 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 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 webmaster@godotengine.org with your username.