My code says the following:
const maxval = 300
var velocity = Vector2.ZERO
func _physics_process(delta):
var input = Vector2.ZERO
if Input.is_action_pressed("ui_right"):
input.x = 1
$AnimatedSprite.play("Right")
elif Input.is_action_pressed("ui_left"):
input.x = -1
$AnimatedSprite.play("Left")
if Input.is_action_pressed("ui_up"):
input.y = 1
$AnimatedSprite.play("Up")
elif Input.is_action_pressed("ui_down"):
input.y = -1
$AnimatedSprite.play("Down")
else:
input = 0
$AnimatedSprite.stop()
if input != Vector2.ZERO:
velocity = input
else:
velocity = Vector2.ZERO
# warning-ignore:return_value_discarded
move_and_collide(velocity * delta * maxval)
But I'm getting this error:
Invalid operands 'int' and 'Vector2' in operator '!='.
I have animations for movement but no Idle animations. And when I just use another code from another project, the animation either plays and doesn't stop or never plays.