← Reference

Decide: cheat sheet

Arcade Foundations · Find each block in the MakeCode toolbox (the category is at the end of each line).

game over

Ends the game: true is a win, false is a loss. Game.

game.gameOver(false)
The block

if

Runs the blocks inside only when the condition is true. Logic.

if (condition) {
    blocks
}
The block

if else

Exactly one part runs: the first when the condition is true, else the second. Click + on an if block.

if (condition) {
    blocks
} else {
    blocks
}
The block

follow

The engine steers one sprite towards another at a speed. Sprites.

enemy.follow(mySprite, 40)
The block

on game update

Runs its blocks every frame, about 30 times a second. Put an if here to keep checking something. Game.

game.onUpdate(function () {
    blocks
})
The block

check every frame

An if inside on game update is asked every frame, so it acts the moment its question becomes true.

game.onUpdate(function () {
    if (car.x > 160) {
        car.x = 0
    }
})
The block

else if

Another question, asked only if the ones above were false. The first true one wins.

} else if (condition) {
The block

compare

Compares two numbers: true or false. Logic; drag a sprite x block into it from Sprites.

mySprite.x > 150
The block

jump

A jump is a speed upwards (negative vy); gravity slows it and brings the sprite back down.

mySprite.vy = -150
The block