Topic: Playing random sounds
Hello guys i found this nice engine and decide to play with it, the first thing i did was modify the FPS Sponza demo character controller to be able to run and jump, i'm a total noob on LUA and coding but coping code from other places and even seeing how other people is using LUA i was able to do almost what i wanted, but i'm now at a roadblock with sound.
what i want is to simulate player walk sounds, so i used a Array to do that, but the sounds are playing very fast and on top of each other, how can why solve this?
This is my array code
walkSound = {} -- array
walkSound[1] = getObject("walk1")
walkSound[2] = getObject("walk2")
walkSound[3] = getObject("walk3")
function onSceneUpdate()
-- move
    if isKeyPressed("W") then
        addCentralForce(Player, {0, walkSpeed, 0}, "local")
        playsteepsounds()
    end
function playsteepsounds()
        characterSounds = math.random(#walkSound)
        playSound(walkSound[characterSounds])
    end
 Now i just need to found out why it only works when used only on one direction
 Now i just need to found out why it only works when used only on one direction  , when i use the same code on the other directions they all play fast again even the walk forward, maybe i need to separate them on individual functions (for example walk forward function a walk backward function, etc) instead of being all inside one function and separated by if statements?
, when i use the same code on the other directions they all play fast again even the walk forward, maybe i need to separate them on individual functions (for example walk forward function a walk backward function, etc) instead of being all inside one function and separated by if statements?