Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: kantor_98 on Sat 02/05/2009 18:27:21

Title: sound while moving
Post by: kantor_98 on Sat 02/05/2009 18:27:21
I like to play a sound (mp3 or midi) while the main character is moving/walking.
I try to use in the repeatdeley execute rutine the code

if (cEgo.Moving) { 
PlayMP3File ("sound7.mp3");
}   

where sound 7 is the sound. But it start to play without stopping.
I a using an ancient AGS (2.71).

Help please !

Thank you.
Title: Re: sound while moving
Post by: RickJ on Sat 02/05/2009 18:40:06
The view editor allows you to play specific sounds for specific frames.  Perhaps that is what you are looking for.
Title: Re: sound while moving
Post by: kantor_98 on Sat 02/05/2009 18:50:06
Well, maybe not really. Because the character can remain on the intermediary position, and the sound shall stop, because the character is not moving. Is there possible to identify if the character is moving, other than I tryed ? Thank you
Title: Re: sound while moving
Post by: RickJ on Sat 02/05/2009 18:53:42
Then I guess I don't understand what you are asking or trying to do.  Sorry?

Title: Re: sound while moving
Post by: kantor_98 on Sat 02/05/2009 19:00:26
I like, as a basic example, toassociate, footsteps sounds to a character, while he is walking, but silence when he is not walking.
Title: Re: sound while moving
Post by: RickJ on Sat 02/05/2009 19:04:26
Then check out what I suggested.  Attach the fotstep sounds to the individual frames.  That's what it's for.
Title: Re: sound while moving
Post by: kantor_98 on Sat 02/05/2009 19:40:25
OK, i try to do this. But I don't know how to insert / associate sound to a frame. I repeat, I use an old version, the 2.71. It is possible to associate a sound to a frame in that version ?
Title: Re: sound while moving
Post by: RickJ on Sat 02/05/2009 19:59:53
It's an old feature so it ought to be there.   Under each frame there is a field for sound number and a field for delay.  Don't remember if it's right or left click to modify but it should be easy enough to figure out.

Btw, you probably should consider upgrading to V2.72 as it is more complete and bug free.  I am not aware of any disadvantages in upreading.
Title: Re: sound while moving
Post by: kantor_98 on Sat 02/05/2009 20:35:40
Thank you very much. I will try and announce you what I have realised. I never used this feathure. It seems to work with right click on the text under the frame.
Title: Re: sound while moving
Post by: kantor_98 on Sat 02/05/2009 20:41:02
I try to make it, but at first try, I failed. No matter, I will still try.
Title: Re: sound while moving
Post by: Dualnames on Sun 03/05/2009 01:18:05
Quote from: kantor_98 on Sat 02/05/2009 20:41:02
I try to make it, but at first try, I failed. No matter, I will still try.

Oh, well if you have so much trouble try putting this on the repeatedly execute section of the game


if (character.Room==player.Room) {
if (character.Moving==true) {
if (character.Frame== frameyouwantgoeshere) {
PlaySound(soundhere);
}
}

}
Title: Re: sound while moving
Post by: Trent R on Sun 03/05/2009 04:51:06
Quote from: Dualnames on Sun 03/05/2009 01:18:05
Oh, well if you have so much trouble try putting this on the repeatedly execute section of the game
May need to be rep_exec_always, if there ever any eBlock walk commands.


~Trent