There may come a time when a user may need to assign an arbitrary number of sprites a unique identifier. For instance, say the user has ten bullet sprites with a local variable. Rather than individually assigning each of them a number in a set () to () block, it might be handy to do this automatically. That way, a script could specifically call bullet number seven without hard-coding it. First, create a global (spriteCount) variable. Then, on the stage add this code: When flag clicked: set spriteCount to 0 broadcast [count sprites] and wait //do something afterwards
| Graph IRI | Count |
|---|---|
| http://dbkwik.webdatacommons.org | 4 |