pressing an attack move overrides idle move when it shouldnt...

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chris33556

hi all,

so ive setup my character to do an air attack during a jump etc. however, when my character is in IDLE standing pose and i press the air-attack button, the sprite flinches as if its about to do the air- attack . the same occurs when walking. The character shouldn’t be performing the stated move. please note the gif below:

here is the script :

update: ive discovered that the reason it is glitching is because the else idle sprite is immediately overriding the previous frame. so i need a command to make the sprite wait a second before changing to and Idle state or i a command that will tell godot that when the sprite should only perform the air attack in the air and not when on the ground.

any suggestions would be helpful thanks

code link is not working.
I guess

if is_on_floor():
    idle anim working
    walk anim  working
    these two are working. so it can't "air attack"
pass

you can add some height for “air attack”
or

  if is_on_floor() and air_attack != false:
    idle anim working
    walk anim  working
pass

and later
when “air attack” works
air_attack = true
and air_attack.
be false when finished

for time

var t = Timer.new

func _ready():
 add_child(t)
 pass

func example():
  t.start(1)
  yield(t, "timeout")
  print("bla bla")
  pass

ramazan | 2022-06-23 08:07