How do I destroy only one instead of destroying everything?

Get help using Construct 2

Post » Tue Mar 24, 2015 2:16 pm

Hi all, I'm a beginner in construct 2 (and sorry for my English... it's my second language).

I'm making a vertical scroller game.
My problem is that I've created spawning platforms that spawns outside the layer (from below) and then they would exit from the top. I can't do the "destroy outside layout" behavior otherwise they would destroy before coming in the layout. So I though to do an invisible object at the top of the layout, that when it collides with the platforms, it would destroy them individually, but it destroys all of them. Any ideas of what I can do?
B
3
Posts: 9
Reputation: 193

Post » Tue Mar 24, 2015 2:28 pm

Platform:Y<0.......Destroy
Image
B
61
S
23
G
7
Posts: 1,468
Reputation: 10,700

Post » Tue Mar 24, 2015 4:11 pm

korbaach wrote:Platform:Y<0.......Destroy


Thank you so much!! that worked perfectly :) thank you again
B
3
Posts: 9
Reputation: 193

Post » Tue Mar 24, 2015 5:55 pm

korbaach wrote:Platform:Y<0.......Destroy


Hello again, I was wandering if you would also know how to stop object from spawning? thanks
B
3
Posts: 9
Reputation: 193

Post » Tue Mar 24, 2015 6:06 pm

You can use a variable.
Create a variable "count = 0"
Spawn objects only if "count < 20"
And increase count by 1 each time you spawn an object.
B
12
S
7
G
7
Posts: 448
Reputation: 4,272

Post » Tue Mar 24, 2015 6:47 pm

Coin-coin le Canapin wrote:You can use a variable.
Create a variable "count = 0"
Spawn objects only if "count < 20"
And increase count by 1 each time you spawn an object.


Thank you!! you are my savior :D
B
3
Posts: 9
Reputation: 193

Post » Tue Mar 24, 2015 7:33 pm

I want to add that recycling the platforms would be better for performance if possible.

Instead of destroying them, move them back to the top.

Also, I take it they scroll down/up so be aware that these platforms won't always be the same distance apart, they get separated and can grow far apart at higher speeds. So plan ahead for some degree of error.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865


Return to How do I....?

Who is online

Users browsing this forum: Carlafnt, Forioga, the_Shit_hawk, Yahoo [Bot] and 8 guests