Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Sound at any place, how to do?

Author
Message
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 1st Aug 2008 10:00
Hi, I´m working in a first person game, I need that when I arrive at precise places sounds a bip. I try loading the sound and using play command in a subroutine, but playes once, if I arrive another time, the sound is not played. Any help for this? Thanks
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 1st Aug 2008 17:50
Gotcha' code? Please post it so we can see what you're doing, therefore help you a bit better.

Otherwise, there is no need to use any flags to do this. But, hold the players old position(position in last program loop)in a variable at top of program. Directly after, record user's current position. These variables can be checked against eachother to know when to play the sound. In your case, if the user was out of the specified location on the last loop, but is now at the specified location in the current loop, then play the sound.

Psuedo example:


Literal example:


I hope this helps you. Ask if you have any questions about it.
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 4th Aug 2008 07:31 Edited at: 4th Aug 2008 16:01
Ok, thanks for the help. I post the code, a short version, but you can have an idea that I want to get.



Note: With this code, the sound playes one time, when I arrive ato a place, at the first time. After, if I arrive at the same or other place, no playes the soun. I'm new at this. I hope that the example helps you to help me. Thanks


[EDIT]Please use code tags - IanM
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Aug 2008 18:45
if you look in the help files it will show
PLAY SOUND Sound Number
PLAY SOUND Sound Number,Start Position

so to make it play again just put a zreo for start position.

commands a bit like at old tape player as to be rewind to start again.

Dark Physics makes any hot drink go cold.
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 5th Aug 2008 00:32
Ok, but in the code that I posted, the only thing to do is for each place I must to use "PLAY SOUND 1, 0"? Well, I test it. Thanks
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 8th Aug 2008 09:40
I tested the code, but when I arrive to any place, the sound is played but is repeated continuously (loop) until I exit the area. I only need that the sound playes once, when I reach a precise place, no more.
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 9th Aug 2008 23:25 Edited at: 9th Aug 2008 23:27
Manchu,



This is exactly what you want. You'll just have to convert from psuedo to literal code.

Also, it seems as if your need has changed from your first post. In your first post you seems to say that the sound is only playing once, though you want it to play more than once. Now it seems as if you are saying you want it to play only once. Which one is it!?
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 11th Aug 2008 07:21
Thanks, I'll test it. Ok, I want to say with only one, is that the sound playes one time, no loop, all times that I arrive to any precise play, I need that the program advices this fact with one bip, no more, do you understand? like a register. Notice that I've used text and images for this, and they work ok, only the sound is a problem. I hope that with your help, can solve it. One more time, thanks
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 12th Aug 2008 01:11
Hmmm...you're making this difficult. I don't fully understand you, except for the cash register part. If I am correct, and I'll be as clear as possible, you want the sound to play each time you enter a position, but only once when within that position. To be more clear, the player can then reenter that position again, and the sound will play again, but only once while in the position.

If this is the case then do this:

psuedo:


This will play the sound only once, but for each time the target position is entered into, and it can be compared to pressing the buttons on a cash register, playing the "ching" sound each time a button is hit:

psuedo:
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 12th Aug 2008 17:21
That's rigth User, my english is very poor (like Tarzan), but I see that you understand the idea of the problem. Like you say, I want the sound to play each time you enter a position, but only once when within that position. I test the code, and I advise how works. Thanks User

Login to post a reply

Server time is: 2024-09-27 18:24:41
Your offset time is: 2024-09-27 18:24:41