Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Castor1010 |
Hello Everyone,
I am new on godot and i have a question
What is wrong with this code
extends KinematicBody2D
var velocity = Vector2.ZERO
onready var animationPlayer = $AnimationPlayer
onready var animationTree = $AnimationTree
onready var animationState = animationTree.get(parameters/playback)
const ACCELERATION = 500
const MAX_SPEED = 80
const FRICTION = 500
func physicsprocess(delta):
var inputvector = Vector2.ZERO
inputvector.x = Input. getactionstrength(“uiright”) - Input. getactionstrength(“uileft”)
inputvector.y = Input. getactionstrength(“uidown”) - Input. getactionstrength(“uiup”)
inputvector = input_vector.normalized()
if input_vector != Vector2.ZERO:
animationTree.set(“parameters/Idle/blend_position”, input_vector)
animationTree.set(“parameters/Run/blend_position”, input_vector)
velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
animationState.travel(“Run”)
else:
animationState.travel(“Idle”)
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
velocity = move_and_slide(velocity)
this code doesn work
onready var animationState = animationTree.get(parameters/playback)
Can anywone explain me