Layout Restart, Spawning Powerups

Get help using Construct 2

Post » Fri Mar 01, 2013 7:31 am

Hey everyone!

So, my question today is.
When I use Keyboard on Press R > System > Restart Layout.

All of the power-ups will spawn right behind the bricks. Here is a picture of what I am talking about.



Now, on the normal start of this Layout everything works fine and those Power-ups only spawn after the blocks have been destroyed.Tekniko2013-03-01 07:32:13
B
50
S
14
G
12
Posts: 813
Reputation: 16,764

Post » Fri Mar 01, 2013 9:52 am

You should reset global variables to their defaults on a start of the layout. That's my guess.
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Fri Mar 01, 2013 2:40 pm

I'm guessing you have 'brick: on destroyed -> spawn powerup' so when you restart the level it's destroying all the bricks and spawning the powerups. You should use a variable to track if the level is finished and don't spawn the powerups when the level is over.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Fri Mar 01, 2013 5:32 pm

Okay, I have absolutely no idea what I am doing so I kind of threw this all together.

I created a new global and called it NewLayoutCheck = 0
On R Pressed > System > Reset Global Variables
On Layout Start set NewLayoutCheck to 1
On Brick destroy and NewLayoutCheck not equal to 0 > Spawn Powerup.

I think there may have been a simpler way of doing this but who knows. For now it works! Yaah.
B
50
S
14
G
12
Posts: 813
Reputation: 16,764


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 25 guests