How do I count instances as a condition?

Get help using Construct 2

Post » Sat Dec 13, 2014 6:00 pm

for example: when key is pressed and there are less than 4 bananas on screen -> create a banana
Trying to find a way to make this work without using families or extra global variables.
B
32
S
10
G
6
Posts: 259
Reputation: 6,776

Post » Sat Dec 13, 2014 6:05 pm

Objects have a count property that returns the number of that object that currently exist. So something like this is what you want
Code: Select all
banana.count < 4 and key pressed, create banana
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sun Dec 14, 2014 12:25 pm

could do it like so
You do not have the required permissions to view the files attached to this post.
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Tue Dec 16, 2014 12:37 pm

got it, thanks guys :)
B
32
S
10
G
6
Posts: 259
Reputation: 6,776


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], FacuLNF and 66 guests