Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | skylabelmho |
My kinematic2D character has a jump, double jump and fall animation, I can move from right to left without problems in the air and on the ground.
The problem occurs specifically in the air, when I press right and left at the same time my animation jump, double jump or fall are interrupted.
I need some scrip to indicate that when I press right and left it doesn’t stop my other animations or something like that, please help.
here my scrip for de jump, doble jump and fall:
func _input(event):
#doble salto
if jump_count < MAX_JUMP_COUNT and int(Input.is_action_just_pressed("ui_up")):
$AnimatedSprite.play("Salto")
!$AnimatedSprite.play("DSalto")
velocidad.y = -vel_salto
jump_count += 1
if jump_count > 1 and !MAX_JUMP_COUNT:
$AnimatedSprite.play("DSalto")
jump_count == MAX_JUMP_COUNT
!$AnimatedSprite.play("Salto")
func _move(delta):
if velocidad.y > 0:
$AnimatedSprite.play("Caer")
in_air = true
Can you post the code that handles your left/right movement? Also, what is !$AnimatedSprite.play("DSalto")
supposed to do? Specifically, I’m wondering why you have a !
in front.
Also, and this is not so important, but just so you know its “script” with a “t”.
Eric Ellingson | 2019-08-21 03:57