Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Pelli |
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