How do I position audio relative to players rotation?

Get help using Construct 2

Post » Wed Jun 14, 2017 8:05 pm

Hi

In the Scirra supplied example (https://dropfile.to/oqHZSOB)

The positioned audioworks only relative to the screen.

Is there a way to make it work relative to the players rotation?
Sort of first person shooter-like audio?
B
7
S
1
Posts: 43
Reputation: 1,052

Post » Wed Jun 14, 2017 9:03 pm

What about a simple trick of setting audio volume based on player angle. That would be just a couple of lines of events like:

CONDITION #1: Dead / Boom / Whatever
CONDITION #2: SYSTEM is between values: angle(player.x,player.y,whatever.x,whatever.y) from BLA angle to BLA angle.
ACTION: Play audio at normal volume

otherwise play at half or 1/3rd volume
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.
My games & gaming portal = DolyGames
If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.
Cheers,
COSMOS
B
21
S
10
G
1
Posts: 79
Reputation: 2,285

Post » Sat Jun 17, 2017 6:30 pm

I tried it here:

https://dropfile.to/tgRAxdU

But it doesn't seem to work at all..
B
7
S
1
Posts: 43
Reputation: 1,052

Post » Sat Jun 17, 2017 7:43 pm

Maybe I just don't quite understand the angle(x1, y1, x2, y2) function?
What should the values be between as an example?
- and a third of the volume - is that like -3 db?
B
7
S
1
Posts: 43
Reputation: 1,052

Post » Sat Jun 17, 2017 9:15 pm

Here you go, I came up with a much simpler solution for you:

audio relative to players rotation by COSMOS for engberg.capx
https://dropfile.to/NCUNcxY
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.
My games & gaming portal = DolyGames
If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.
Cheers,
COSMOS
B
21
S
10
G
1
Posts: 79
Reputation: 2,285

Post » Sun Jun 18, 2017 8:28 am

Hi - thank you for the effort!

What I'm trying to achieve is when the player-sprites right ear is towards the explosion, then it should only be heard in my right ear..
Imagine closing your eyes, you should be able to find the explosion with only the audio..

That doesn't happen in your example - and in the scirra supplyed example - it only works relative to my position in front of the screen - not relative to the player-sprite..
B
7
S
1
Posts: 43
Reputation: 1,052

Post » Sun Jun 18, 2017 10:02 am

Hi,

Well I answered, I think correctly, this forum thread which was about "relative to players rotation".

You are now speaking about stereo audio, i.e. different sound per left and right speaker/headphone. You can still use my system / suggestion by having then 2 of those "visible triangles" but to the right and left of the player, so triggering is no problem, but I have not learned or seen anything about a stereo audio in C2, so maybe it does not exist or maybe a more experienced person can answer.
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.
My games & gaming portal = DolyGames
If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.
Cheers,
COSMOS
B
21
S
10
G
1
Posts: 79
Reputation: 2,285

Post » Sun Jun 18, 2017 12:08 pm

I apologise if the title was misleading..

I might be able to use your example, but then split the sound source in right and left channel..

But then it is crucial, that they start at the same time..
B
7
S
1
Posts: 43
Reputation: 1,052


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 18 guests