Out-of-layout projectile sprites make noise on game start

Just started using Construct 2? Post your questions here

Post » Sat Jan 10, 2015 6:38 am

I have some projectile bullet sprite objects. They have a destroyoutsidelayout behavior. This prevents them from spawning in the layout when the game starts, but the player is still able to spawn them.

I also have a sound that plays when these sprites are created, a shooting noise.

Whenever the game starts, the noise happens too. I know this is because the sprites are stilled being created outside of the layout and thus, spawns a noise, even though they're destroyed instantly and are never seen.

This has annoyed me far too long, especially now that I'm racking up different ability sprites with unique sounds. Getting tired of my ears getting blasted with five loud sounds at once that are coming from nowhere. How do I fix this?

This is an example of what I'm talking about, from my editor.
Image
B
21
S
5
Posts: 109
Reputation: 1,500

Post » Sat Jan 10, 2015 3:14 pm

You can put those sprites on another layout. Just create a new layout to hold all the sprites that you don't need at the start of the game.

Or you could add a condition to the sound playing action to check that the sprite isn't outside the layout.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Sat Jan 10, 2015 7:48 pm

this works, thanks!
B
21
S
5
Posts: 109
Reputation: 1,500

Post » Fri Jan 16, 2015 6:24 pm

I know this was already solved, but here's another method anyways.

You could just add a 'Destroy when outside Layout' behaviour to them. Alternatively, you can add an 'Object is On-Screen' condition to the event line handling the audio for the object.
B
7
S
1
G
1
Posts: 4
Reputation: 422


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest