Gamestudio Links
Zorro Links
Newest Posts
Bug in train mode, or it seem to me
by mistery. 09/24/26 17:34
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 09/22/26 12:21
Capital slider is not saving in Z12
by Petra. 09/22/26 06:49
Parent/child object
by VoroneTZ. 09/22/26 05:52
Zorro tutorial ideas?
by AndrewAMD. 09/21/26 14:50
Trades during a running bar
by Martin_HH. 09/21/26 12:03
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Tempelbauer, 1 invisible), 8,453 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Knull, Opus, Jubilee, lopezsergio07, mistery
19240 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
footsteps - sound plays too much! #186531
03/01/08 01:54
03/01/08 01:54
Joined: Jan 2008
Posts: 10
Brisbane, Australia
J
JJJohan Offline OP
Newbie
JJJohan  Offline OP
Newbie
J

Joined: Jan 2008
Posts: 10
Brisbane, Australia
I couldn't really find a way to describe this in the the title so here goes.

I've been working on my little game this morning, added a nice zoom effect, a crouch feature and am now trying to add walking sounds. It doesn't work very well.

The problem is that the sound isn't stopped from playing more than one at a time resulting in a horrible screeching of hundreds of sound copies at a time.

Code:

sound run_wav = <run.wav>;
sound startrun_wav = <suddenwalk.wav>;

function run()
{
var startedrunning;
var running;
if (snd_playing(startedrunning) == 0)
{
startedrunning = ent_playsound (player, startrun_wav, 50); // play the bullet sound at a volume of 100
}
while (key_w > 0)
{
if (snd_playing(running) == 0)
{
running = ent_playsound (player, run_wav, 100);
}
sleep(0.01);
wait (1);
}
snd_stop (running);
snd_stop (startedrunning);
}




The first sound startedrunning is the sound of the player's equipment rattling. The second one, running, is the running loop. I was originally playing with loops but due to the sound bug I decided to make it a sound for now.

It might just be me not being awake yet, but I can't seem to solve it, even when using variables such as:

Code:

var soundisplaying;
if (soundisplaying == 0)
{
---play the sound---
soundisplaying = 1;
}



Bah.

Re: footsteps - sound plays too much! [Re: JJJohan] #186532
03/01/08 06:57
03/01/08 06:57
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13


var_nsave run_handle;


if(snd_playing(run_handle)!=1)
{
run_handle=snd_play(run_wav,100,null);
}


use snd_stop(run_handle); to stop if playing when you dont want it too




Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1