Events (16/16)

1. when Start clicked

  • Run the script below when the "Start" button is clicked.

2. when this sprite [clicked]

  • Run the script below when the sprite on stage is clicked/pressed/released.

3. when phone screen swiped [up]

  • Run the script below when the phone screen is slid up/ down/ left/ right.

4. when [a] [pressed]

  • Run the script below when a specific key is pressed/released
StatePressed, Released
Keyboard26 characters, numbers 0-9, arrow keys, Space bar, Enter key, any key

5. when <condition>

  • When the condition is true, run the script below.
  • This block can help to reduce blocks and make the script run more smoothly.
  • For example: below block sets can achieve the same effect, but the block set on the right is much more concise.

6. stop [all script]

  • stop [all script]: Stop all the script.

  • stop [current script]: Stop the script of this block set.

  • stop [other script of this sprite]: Stop other scripts of this sprite.

  • stop [script of other sprites]: Stop the script of other sprites on stage.

7. stop

  • Stop the whole game.

8. restart

  • Reset to the original state and run the script again.
  • Tip: this block is often used to give the player another chance to start again when he/she fails in game or the game ends.

9. when I receive ("Hi")

  • Run the script below immediately once it receives the broadcast.
  • This block should be used with "broadcast" block.
  • Please note: broadcast can be used between different sprites and backgrounds.

10. broadcast ("Hi")

  • Send a message to all sprites and backgrounds. The sprites or backgrounds that receive the broadcast will do certain actions.
  • This block should be used with "when I receive" block. Enter the broadcast name to identify it.

11. when screen switches to [Screen1]

  • When the screen switches to a certain screen, run the script below.
  • If there are several screens in your project, try to use this block.

12. switch to screen [Screen1]

  • There could be several independent screens on stage. Use this block to fast switch to certain scene.
  • Tip: this block can be used to switch to game cover, lever page, success and failure page of RPG game.

13. switch to screen (1)

  • Fast switch to the screen of input number.
  • Please note: if any screen is deleted, the number of the screens will be automatically rearranged in order. Pay attention to the possible changes.

14. when I start as a clone

  • Run the script once the clone it's created.
  • The clone can be cloned again. The maximum number of clones is 300.

15. clone [?]

  • "clone" is to create an "empty-code clone" of the sprite, which can copy all the state of sprite when it is cloned (including size, angle, coordinates, mass, styles and so on, except script). Clones of the same sprite in different moment are in different state.

  • Tip: you can try below blocks to see how it work when Codemao is clicked~

16. delete

  • Delete the current sprite when the game is running, including its styles and blocks.

  • Often used to delete clone.

When a large number of clones is used, do remember to delete them in time!

  • Application:

When you fire a shell in Aircraft Fight and the cloned shell shoots out the screen, delete the clone in time. Otherwise it may cause delay while running the game.