step sound

Posted By: WeTwoPlays

step sound - 10/20/12 18:13

action player_all ()
{
while(1)
{
camera_follow(me);
my.pan += (mouse_force.x)*-5*time_step;
var distance = (key_w-key_s)*11*time_step;
c_move(me, vector(distance,0,0), NULL, GLIDE);
var distance1 = (key_a-key_d)*11*time_step;
c_move(me, vector(0,distance1,0), NULL, GLIDE);
wait(1);
}
}
wehen i use
if (distance > 2)
{
media_loop("schritte.wav",NULL,100);
wait(1);
}
the walk speed slows down extreamly.....
what can i do?
(Yes I'm a beginner)
Posted By: Pappenheimer

Re: step sound - 10/20/12 18:35

You can avoid that the step_sound ist played immediately again and again although it has been already started, when you check whether the sound is still playing:
http://www.conitec.net/beta/asnd_playing.htm

SOUND* step = step.wav;

...
var step_handle = ent_playsound(my,step,100); //set a handle to the playing sound
if(snd_playing(step_handle) == 0) // check whether the sound is still playing, if it is not playing, play it
{
snd_play(step_handle,100,0);
}
Posted By: WeTwoPlays

Re: step sound - 10/20/12 18:42

THX
Posted By: WeTwoPlays

Re: step sound - 10/20/12 18:44

BUT I HAVE NO WHEATHER
Posted By: Pappenheimer

Re: step sound - 10/20/12 20:09

Pardon?
Vielleicht mal in Deutsch?
Posted By: WeTwoPlays

Re: step sound - 10/20/12 22:11

es soll aber für alle verständlich sein ich versuch
function step()
{
if (key_w)
{
media_loop("schritte.wav",NULL,100);
}
}
Posted By: Superku

Re: step sound - 10/20/12 23:02

Haha weather? I suggest you check the meaning of "whether", not "weather/ wheather", and read Pappenheimer's post again.
I suggest you don't use the media_... but snd_... instructions, the latter have a few advantages. Additionally, if the sound is for the player, use snd_..., otherwise, for enemies and the like, use ent_playsound to achieve a 3dimensional sound effect (you can try to deactivate the doppler_effect, too, I don't like it).
Posted By: rayp

Re: step sound - 10/23/12 18:12

Quote:
var step_handle = ent_playsound(my,step,100); //set a handle to the playing sound
if(snd_playing(step_handle) == 0) // check whether the sound is still playing, if it is not playing, play it
{
snd_play(step_handle,100,0);
Or combine your walking animation percentage with the sound playing function.
© 2024 lite-C Forums