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
34
S
10
G
6
Posts: 259
Reputation: 6,831

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,126

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
261
S
46
G
15
Posts: 1,997
Reputation: 41,873

Post » Tue Dec 16, 2014 12:37 pm

got it, thanks guys :)
B
34
S
10
G
6
Posts: 259
Reputation: 6,831


Return to How do I....?

Who is online

Users browsing this forum: Bing [Bot] and 40 guests