Category:Events

Triggers a sequence of blocks to run when a specific sprite touches another specific sprite.

Sometimes code should only be run if an event happens. In this case, when a specific sprite touches another specific sprite, the blocks attached under the event block will begin to run sequentially. If the costume block is used in either parameter, the event will check for touches between any sprites of the matching costume(s).

This block has a drop-down menu with “when” and “while” options. “When” a sprite touches another sprite, the code will only run once. “While” a sprite is touching another sprite, the code will run over and over again until the sprites stop touching.

Parameters

NameDescription
when/while Determines if the code is run when the sprite touches another sprite (runs once at a time) or continuously while the sprite is touching another sprite
sprite The sprite or sprite group of the sprites touching

Tips

  • For group events, use the this / other sprite block in the following actions to only affect the sprite that was touched.

Found a bug in the documentation? Let us know at documentation@code.org