BlocosIA Wiki Editor

2D platform game (2D World)

Easy · Build a level with ground, coins and a flag, make the hero run, jump and grab coins, with background music.

Interactive tutorial: the editor checks each step by itself.

  1. Add the "2D World" extension. The Extensions button opens the list and the extension blinks: click "Add".
  2. In the 2D World category, click "Open the 2D World editor". Choose "Complete Platform Level" and click Save.
  3. Choose the hero sprite in the list below the stage.
  4. In Events, drag "when green flag clicked" to the code area.
  5. In 2D World, snap "camera follow" (choose your sprite) and "turn on gravity with force 1" under the flag.
  6. In Control, snap a "forever" and, inside it, an "if … then" with "key right arrow pressed?" (Sensing). Inside the "if", put "change x by 5" (Motion).
  7. Do the same for the left arrow with "change x by -5".
  8. To jump: another "if" with "key space pressed?" and, inside, "jump with force 14" (2D World).
  9. Coins: drag "when I touch the coin block" (2D World) and snap "erase the coin blocks I am touching" and "play sound" (Sound).
  10. Music! In the Sound category, snap "play background music … on loop" under the flag and pick a track (♫).
  11. Click the green flag, click the stage and play: arrows to walk and space to jump!
  12. Challenge: "when I touch the flag block" + "play sound level complete" + "say I won!". (challenge)

The blocks of the finished program

• evt_bandeira
• mun_seguir
• mun_gravidade [G: 1]
• som_fundo [SOM: trilha aventura 8-bit]
• ctl_sempre
  • ctl_se [COND: (sen_tecla)]
    • mov_mudar_x [DX: 5]
  • ctl_se [COND: (sen_tecla)]
    • mov_mudar_x [DX: -5]
  • ctl_se [COND: (sen_tecla)]
    • mun_pular [F: 14]

• mun_quando_tocar [BLOCO: moeda]
• mun_pegar [BLOCO: moeda]
• som_tocar [SOM: moeda]

Open in the editor