In Scratch can you set numerical values for Sprites and/or their Costumes. I would like to do this to control parts of my program by allowing certain Sprites to be ordered, or to assign values to several costumes for the same Sprite and have the commands recognize the values for control purposes. Similarly, does Scratch recognize values for alphabetic Sprites? For example it you had some Sprites representing the letters B,C, and A, could it recognize them and arrange them in alphabetical order i.e. A < B < C ? When you create them, you can use a text tool in the create panel. So you would actually be typing an A, B, or C to create them. Does Scratch retain the ASCII values of these Sprites or Costumes so they can be manipulated accordingly?
1 Answer
Can you set numerical values for sprites and/or their costumes?
There's a variable under the Looks category named costume # that stores the current costume number of the sprite. You can use variables under the Data category to play with number either locally (i.e., for a specific sprite) or globally (i.e., among all sprites).
Does Scratch recognize values for alphabetic Sprites?
It's easy to compare between values and variables in the script of a specific sprite. However, you'll probably need to implement this manually because it's not that easy to compare between local data of the sprites unless you come up with an idea in terms of broadcasting and receiving maybe.
Does Scratch retain the ASCII values of these Sprites or Costumes so they can be manipulated accordingly?
I think no because they're treated as images not text.