![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | JayH |
Hi,
My foot dust particles don’t always fire when the Player lands on the ground. This is especially true for my Player’s shorter jumps.
Here’s part of the script:
#MAIN ROUTINE
func _physics_process(delta):
#MAIN PLAYER MOVEMENT
if !climbing :
#MOVE PLAYER LEFT/RIGHT
if Input.is_action_pressed("ui_right") :
myVelocity.x = PLAYERSPEED
$AnimatedSprite.play("Walk")
$AnimatedSprite.flip_h = false
$AnimatedSprite.set_offset(Vector2(1,0))
elif Input.is_action_pressed("ui_left") :
myVelocity.x = -PLAYERSPEED
$AnimatedSprite.play("Walk")
$AnimatedSprite.flip_h = true
$AnimatedSprite.set_offset(Vector2(0,0))
else:
myVelocity.x = 0
if onGround == true:
$AnimatedSprite.play("Idle")
#VARIABLE JUMP HEIGHT
if Input.is_action_just_pressed("space"):
myVelocity.y = JUMPPOWER
elif Input.is_action_just_released("space"):
myVelocity.y = -JUMPLOW
myVelocity.y += GRAVITY # ADD GRAVITY TO THE PLAYER
#SET IF ON THE GROUND OR NOT
if is_on_floor():
if not onGround:
$FootDust.emitting = true #Play Foot Dust Particle
onGround = true
else:
onGround = false
if myVelocity.y < 0:
$AnimatedSprite.play("Jump")
if myVelocity.y > 0 :
$AnimatedSprite.play("Fall")
myVelocity = move_and_slide(myVelocity, FLOOR) #MOVE PLAYER WALKING
Any ideas?