Very simple standard go left/right script, but im looking to insert a 4 frame 'turning round' animation to my 2d character in between turning left or right depending on the direction your looking in.
I know im on the right track, but not close enough!
My ideas are brilliant, but my coding isnt!!
Help/pointers appreciated, Ta!
extends KinematicBody2D
var velocity = Vector2()
const speed = 300
func _physics_process(delta):
if Input.is_action_pressed("ui_right"):
velocity.x = speed
if $AnimatedSprite.flip_h == true: < The offending bit does nothing....
$AnimatedSprite.play("Turn", true) <
$AnimatedSprite.flip_h = false
$AnimatedSprite.play("Walk")
elif Input.is_action_pressed("ui_left"):
velocity.x = -speed
if $AnimatedSprite.flip_h == false:
$AnimatedSprite.play("Turn")
$AnimatedSprite.flip_h = true
$AnimatedSprite.play("Walk")
else:
velocity.x = 0
$AnimatedSprite.play("Blink2")
velocity = move_and_slide(velocity)