On Scratch, there are two ways to start a project: directly and indirectly. A direct start utilizes the When Green Flag Clicked block to begin running the project. However, an indirect start does not use that block but instead uses different triggers for beginning the project.
In many cases, starting a project based on an event besides the green flag being clicked has a huge advantage over starting a project directly. Below are some reasons as to why this is true:
- The events that happen as an "introduction" to the project can be put in with ease.
- The game can easily be re-executed.
- Buttons can be designed to press instead of the green flag.
- Multiple green flags can cause a slight delay between each, which can be remedied by this method.
What is "Indirect Start"?
Indirect start is the action of assigning the triggering of an event to something other than "when ⚑ clicked".
when I receive [Game Start v] . . .
when gf clicked . . .
All things in the world of Scratch start by clicking the green flag. This script is for executing the "Game Start" script.
when gf clicked broadcast [Game Start v]
Uses of Indirect Starts
Starting It Off with a Cannon
This example is about making a project where a cannon is clicked to shoot fireworks in the sky. The following script is added to each cannon.
when this sprite clicked//This is the cannon being clicked on broadcast [Start the Fireworks! v]
Restarting a Game
This example is about a game where the player is given a chance to restart a game when they die.
when I receive [GAME OVER v] wait until <mouse down?>//This gives the player a chance to restart by clicking broadcast [Game Start v]
If each script was designed to start when the green flag is clicked, the project would contain the following script instead.
when I receive [GAME OVER v] broadcast [Tell the Player to click on the Green Flag again v]
Making a Title Screen
This example is about adding a title screen to a game. Such projects contain the following script.
when gf clicked broadcast [Show Title Screen v]
After showing the title screen, there are sprites that act as buttons that the player clicks on in order to start the game.
when I receive [Show Title Screen v] wait until <<mouse down?> and <touching [mouse-pointer v]?>>//this is when the player clicks on the button broadcast [Game Start v]
It is possible using this method to make a project that shows a title screen before it starts. This is impossible when the project starts the game directly instead of using "Game Start".