ScratchData LogoScratchData
Back to thisandagain's profile

Example - Execution Order

THthisandagain•Created September 2, 2019
Example - Execution Order
42
31
1058 views
View on Scratch

Instructions

This project demonstrates the order that different scripts run in Scratch. This is called "execution order" and can be important when you are trying to coordinate "broadcast" / "when I receive" events between sprites. As this project shows, the execution order is largely determined by the "z-index" sort order of the sprites. Essentially, the sprite on top will execute first and the sprite in the back (followed by the stage) will execute last! If you "See Inside" on this project you can play with this yourself by changing the sort order of the different dinosaur sprites. In your projects you can do this by dragging sprites around on the stage or by using the "go to layer" blocks in the "looks" category.

Description

Thanks to @DarkDimension for the great question: "Hi, I was wondering what order scripts are executed in scratch. For example, I would broadcast a message, and multiple sprites would receive it. Could you tell me what would determine the order of execution in a scenario like this?" Here is another project that shows this behavior as well as another detail of execution order that involves the sort order of scripts within each sprite: https://scratch.mit.edu/projects/18490761/

Project Details

Project ID326609039
CreatedSeptember 2, 2019
Last ModifiedNovember 1, 2019
SharedSeptember 2, 2019
Visibilityvisible
CommentsDisabled