0 votes

I have this code:

   if Velocity.y <  0:
    _jump()
            $Sprite/Chicken_fire= false
    $Sprite/Chicken_Idle_eo.visible = false
    $Sprite/Chicken_Profile.visible = false
    $Sprite/Chicken_jump.visible = true


if (velocity.length() > 0) and (is_on_floor()):
    _run()
            $Sprite/chicken_fire = false
    $Sprite/Chicken_Profile.visible = true
    $Sprite/Chicken_Idle_eo.visible = false
    $Sprite/Chicken_jump.visible = false

if (velocity.length() == 0) and is_on_floor():
    _idle()
            $Sprite/chicken_fire = false
    $Sprite/Chicken_Idle_eo.visible = true
    $Sprite/Chicken_Profile.visible = false
    $Sprite/Chicken_jump.visible = false

     if is_on_floor() and velocity.length() == 0 and Input.is_action_just_pressed("shift") :
    _shoot()
                $Sprite/chicken_fire = true
            $Sprite/Chicken_Idle_eo.visible = false
        $Sprite/Chicken_Profile.visible = false
        $Sprite/Chicken_jump.visible = false
        _fire()

func idle():
state
machine.travel("Idle")

func run():
state
machine.travel("Run")

func jump():
state
machine.travel("Jump")

func dead():
state
machine.travel("Dead")

func fire():
state
machine.travel("Fire")

All the states work well, the only problem that I have is that when I have to go from "idle" to "fire" it´s goes very very fast again to "idle" so it´s overraiding, on animation tree I have the transition atEnd from "fire" to "idle" so it dosen´t work

in Engine by (126 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.