Gets a specific sprite from an event.
Using the costume
block, you can program with events to check for interactions involving any sprite with the same costume(s). This block allows you to program an action to only affect the sprite that triggered the event. In an event that involves two sprites, “this” refers to first sprite in the event, and “other” refers to the second sprite. Using this block makes it possible to apply actions to specific sprites after an event without having to use a sprite name or affect the whole costume group.
Using “this” lets an action apply to just one sprite in a costume group without creating a name for every sprite. In this example, any sun that is clicked will disappear when clicked without affecting the others.
“Other” only works if more than one sprite is involved. When two sprites touch, “this” and “other” can be used to make a different action occur for each sprite. Press 'up' and 'down' arrows to have the middle sprite eat the pizza.
Name | Description |
---|---|
this/other | Two options: this or other. Default is this. |
Found a bug in the documentation? Let us know at documentation@code.org