Block execution order

Description of blocks

Blocks added to the workspace are executed once, at the time the block or block construction is called. To loop or repeat execution N number of times, you must place a block or construct in the appropriate block from the “Chains” section

The block execution logic is executed sequentially, starting with the “Preparing the scene” block, which performs all actions within itself before the start of the project

Next, if you want to make presets for the project, place the “Run chain at scene start” block in the editor. For example, enable or disable gravity for the player

Both of these blocks are in the Events" block category

Logic Execution Order

Blockly blocks have a number of events that execute in a predetermined order as the logic executes. This execution order is described below:

Scene preparation

Initialization of objects on the stage - loading and placing objects on the stage

Initialization of object events - subscription to events of objects used in logic

Scene start

Execution of blocks located in the “Start the chain at the start of the scene” and free blocks

Game logic

Execution of parallel chains, event handling


Example 1

  • The first block will be executed once when the scene is loaded
  • The second block will also be executed once, since it is not burdened with any condition for execution and it will also be executed at the moment of scene initialization

Example 2

Consider an example with a robot

In this case, the logic of the “Execute without waiting” blocks from the “Chains” section is used. If the blocks are connected in one logical chain, then their execution will be parallel, that is, each of the actions will be performed without waiting for the completion of the previous one, and so on for each block in the structure

Only one action block can be placed in the “Execute without waiting” block!

In logic, the robot is given:

  • Rotate around the Z axis at 500 degrees per second
  • Move in the direction of the X axis at a speed of 1 meter per second

These two actions are in the same construct, each of which is placed in “execute without waiting”, so they will be executed in parallel