Sounds problem need help.

Get help using Construct 2

Post » Sun Jul 07, 2013 4:55 am

hello people am new to construct 2.
am making a shooter game and i want to make a gunshot sound to work correctly.
so i made it when i have left click down to shoot and spawn a bullet.
am trying to put a sound when the bullet is created, i achieved that but the problem is that when the game starts the sound is played once how i can stop this?
i have the bullet on the layout, please tell me what i can do, or some opinions. thank you
B
7
S
2
G
1
Posts: 16
Reputation: 2,180

Post » Sun Jul 07, 2013 11:08 am

Ahh ok I had the exact same problem.

I solved it this way.

Make a Global variable called "Game_loaded = 0" or something, so if this is 0 you know the game "haven't" loaded yet.

Next, and think this is a good idea to do no matter what, as it will remove a lot of potential problems later on.

Make a "start of layout" and here you destroy all objects that are not needed. Like enemies, rewards, bullets and so on. And stuff like HUDs, background, that should be permanently visible you don't destroy.

At the end of this event when all objects have been destroyed you set "Game_loaded = 1"

And then in the "Bullet fired" event you just check if "Game_loaded = 1"

Another way is that you might be able to just mute the sound before you destroy it, and then just unmute afterwards. In a "Sound finished playing" or what its called, think that might work as well.


nimos1002013-07-07 11:09:45
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sun Jul 07, 2013 11:23 am

[QUOTE=rottenwolf24] hello people am new to construct 2.
am making a shooter game and i want to make a gunshot sound to work correctly.
so i made it when i have left click down to shoot and spawn a bullet.
am trying to put a sound when the bullet is created, i achieved that but the problem is that when the game starts the sound is played once how i can stop this?
i have the bullet on the layout, please tell me what i can do, or some opinions. thank you[/QUOTE]

I usually have 'Objects' layout or something similar, where I place 1 copy of every object. This layout is never used in game, just holds the objects. Now I don't have to place any extra objects outside layouts etc. on my actual layouts.
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Sun Jul 07, 2013 5:33 pm

I thank both of you, i think both ways are good thanks a lot i been trying to solve this for a week!
B
7
S
2
G
1
Posts: 16
Reputation: 2,180

Post » Sun Jul 07, 2013 5:39 pm

These tips belong to my favorite category: So simple, yet so effective. Thanks.
B
6
S
1
Posts: 17
Reputation: 459

Post » Sun Jul 07, 2013 5:42 pm

it doesn't work none of the ways
B
7
S
2
G
1
Posts: 16
Reputation: 2,180

Post » Sun Jul 07, 2013 5:56 pm

See if you can post a trimmed down example of the problem. Either of those methods should have worked, so something else is probably causing it.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Sun Jul 07, 2013 6:13 pm

what is a trimmed down example?
B
7
S
2
G
1
Posts: 16
Reputation: 2,180

Post » Sun Jul 07, 2013 6:19 pm

If you don't want to post your whole game, then remove bits until just the sound problem exists, or, make a new file but do the same sound logic.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Sun Jul 07, 2013 6:30 pm

am uploading it
B
7
S
2
G
1
Posts: 16
Reputation: 2,180

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests