object count

For questions about using Classic.

Post » Tue May 19, 2009 8:47 pm

If you have several objects in a scene how can you find out how many of one particular object there is at runtime?
B
27
S
2
G
3
Posts: 61
Reputation: 2,498

Post » Tue May 19, 2009 8:52 pm

object.Count

You can use object.Count as an expression. To get to it in the object pane of the event window, double-click the object, and under Misc there will be "Get the number of objects." Or just type in object.Count (replacing "object" with whatever the name of your object is, of course).

For instance:

[code:3p3uveo1]
+ System: Compare: object.Count is Less than 5
-> Do stuff
[/code:3p3uveo1]

or

[code:3p3uveo1]
+ Some condition
-> Object: Set speed to object.Count*5068
[/code:3p3uveo1]

or

[code:3p3uveo1]
+ Always
-> Set text.Text to object.Count
[/code:3p3uveo1]
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests