How do I limit the number of objects in a layout?

Get help using Construct 2

Post » Fri Apr 14, 2017 3:50 pm

Message: techkenb can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi, I got some help from theubie in this post about how to limit sprites.
how-to-limit-the-number-of-object-in-a-layout_p655915?#p655915
but I am still having a little trouble. I have added the event "sprite.count greater than 2"
No what is the next step? what is the action that will prevent further spawns of that sprite?

Thanks!
B
6
S
2
Posts: 6
Reputation: 462

Post » Fri Apr 14, 2017 11:42 pm

Plz, show how you spawn.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Apr 15, 2017 1:27 am

Right now I have --> System Every random(1,5) seconds --> Create object sprite on layer 0 at (0,0)
B
6
S
2
Posts: 6
Reputation: 462

Post » Sat Apr 15, 2017 2:41 am

@techkenb

add another condition to the every random seconds that says sprite.count Less Than MaxSprites

(where MaxSprites is the number you want to limit at)
This will then only create a new instance of Sprite if there is less than the maximum number you want to allow.
You don't need the Sprite.count greater than 2...
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Sat Apr 15, 2017 2:58 am

ok I will give it a try thanks!
B
6
S
2
Posts: 6
Reputation: 462

Post » Sat Apr 15, 2017 6:58 pm

AllanR, that worked great thanks so much. I have another question. I have some balloons that move within a box and collide with the walls. I want them to stay upright in the box, well no more than 20 degrees upright. Right now they bounce all over the walls and some of them end up upside down. (kinda strange for a balloon don't you think?) well let me know what direction I should proceed on this.
B
6
S
2
Posts: 6
Reputation: 462


Return to How do I....?

Who is online

Users browsing this forum: dop2000, humanescape, warmty and 6 guests