Running sound effects don't continue when I land back on the ground

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

Noobing here. Been at it for a whole 3 days!

My run sound effects are all working well aside from one (so far). The effect works when running right and left. It stops when is_action_just_released(“ui_right/ui_left”). When I jump the effect stops correctly, but when I land back on the ground while staying in motion the effect doesn’t continue. Any ideas?
Thanks =)

Sounds like a script-related problem. You’ll probably need to post the relevant script(s) for more assistance.

jgodfrey | 2020-02-17 16:50

:bust_in_silhouette: Reply From: Bernard Cloutier

Sounds like you might be starting the running sound by checking is_action_just_pressed, which prevents the sound from starting if the action was already pressed and held before landing. However, as Jgodfrey remarked, such questions are really hard to answer without being able to read the code. Please post the complete script in which the running sound is started/stopped. You can use the curly braces icon {} above the text box to nicely format code blocks, like this:

extends Node2D

var myVar = "hello"

func _ready():

this is pretty much all the audio (RunFx) i have for running. I cant figure out how to continue the run sound on landing from a jump. i tried

if velocity.x > 0:

but quickly realized it triggers the sound continuously as it checks per frame…woah. annnnd i feel like i just answered my question… ill get back to you. thanks for the replies!
if is_on_floor():

	if Input.is_action_just_pressed("Jump"):
	if Input.is_action_just_pressed("ui_right"):
	if Input.is_action_just_pressed("ui_left"):
	if Input.is_action_just_released("ui_left"):
	if Input.is_action_just_released("ui_right"):

Ooopsies | 2020-02-24 10:45

yep i figured it out! i was focused on velocity.x rather than velocity.y.

pretty crazy how “saying something out loud” gives you answers sometimes. its also crazy how thrilling it is when a problem gets fixed. haha. thanks again dudes!

Ooopsies | 2020-02-24 11:11

You might like this then:

Bernard Cloutier | 2020-02-24 15:05

Hi just wanted to know whether this is the final code?

i_am_dhrutiman1999 | 2020-08-17 17:38