When there is second ''stop'' in other key Animation doesn't play at all
but when "stop " is only in one key its plays
doesn't work
onready var _animated_sprite = $body
func control(delta):
var rot_dir=0
if Input.is_action_pressed("right"):
rot_dir +=1
_animated_sprite.play("trekcs")
else:
_animated_sprite.stop()
if Input.is_action_pressed("left"):
rot_dir -=1
#_animated_sprite.play("trekcs")
rotation+=Rotation_speed*rot_dir*delta
velocity=Vector2()
if Input.is_action_pressed("forward"):
velocity=Vector2(max_speed,0).rotated(rotation)
_animated_sprite.play("trekcs")
else:
_animated_sprite.stop()
if Input.is_action_pressed("back"):
velocity=Vector2(-max_speed/2,0).rotated(rotation)
#_animated_sprite.play("trekcs")
this works when stop func in just one place
onready var _animated_sprite = $body
func control(delta):
var rot_dir=0
if Input.is_action_pressed("right"):
rot_dir +=1
_animated_sprite.play("trekcs")
else:
_animated_sprite.stop()
if Input.is_action_pressed("left"):
rot_dir -=1
#_animated_sprite.play("trekcs")
rotation+=Rotation_speed*rot_dir*delta
velocity=Vector2()
if Input.is_action_pressed("forward"):
velocity=Vector2(max_speed,0).rotated(rotation)
_animated_sprite.play("trekcs")
if Input.is_action_pressed("back"):
velocity=Vector2(-max_speed/2,0).rotated(rotation)
#_animated_sprite.play("trekcs")