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