game over
Ends the game: true is a win, false is a loss. Game.
game.gameOver(false)
Arcade Foundations · Find each block in the MakeCode toolbox (the category is at the end of each line).
Ends the game: true is a win, false is a loss. Game.
game.gameOver(false)
Runs the blocks inside only when the condition is true. Logic.
if (condition) {
blocks
}
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 engine steers one sprite towards another at a speed. Sprites.
enemy.follow(mySprite, 40)
Runs its blocks every frame, about 30 times a second. Put an if here to keep checking something. Game.
game.onUpdate(function () {
blocks
})
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
}
})
Another question, asked only if the ones above were false. The first true one wins.
} else if (condition) {
Compares two numbers: true or false. Logic; drag a sprite x block into it from Sprites.
mySprite.x > 150
A jump is a speed upwards (negative vy); gravity slows it and brings the sprite back down.
mySprite.vy = -150