Skip to Content

Is it possible to count spites in project?

« How do I...?
3 replies [Last post]
Evgeny Patarakin
Member

 How can I count sprites in project? Or may be it possible to ask ID of each sprite?

Replies
Karen Brennan
Member

I'm curious -- what are you trying to do in the project?

Rick Ashby
Member

Generating an ID for each Sprite is also possible but how you do it depends a lot on how you intend to use the IDs.  I'll send a few examples this evening.

Rick Ashby
Member

Counting the sprites is a snap.

  1. Create a "Counter" sprite to do the counting.
  2. Add this script to it: when counter clicked-> broadcast "count sprites"
  3. Then create a variable for for all all sprites called "Number of Sprites"
  4. Then for each sprite that you wish to count, add this script: when I receive "count sprites"->change "Number of Sprites by 1.

You can modify that foundation to suite your needs.