1. Every one of a kind
Try firstThere are 5 enemies on the screen. A for element loop over array of sprites of kind Enemy contains change score by 1. How much does the score go up?
Check your answer
By 5. The list has 5 enemies, and the loop runs its blocks once for each one.
- array of sprites of kind Enemy is a list of every enemy in the game right now.
- A for element loop runs its blocks once for each item in the list, with value as that item.
- Blocks inside the loop run once per sprite; blocks after it run once.
So one press of B can reach every enemy, even though none of them has a name.

Show as code
scene.setBackgroundColor(15)
let ship = sprites.create(img`
. . 1 . .
. 1 1 1 .
1 1 1 1 1
`, SpriteKind.Player)
ship.setPosition(80, 110)
controller.moveSprite(ship, 100, 0)
game.onUpdateInterval(1000, function () {
let alien = sprites.create(img`
. 7 . 7 .
7 7 7 7 7
7 f 7 f 7
. 7 . 7 .
`, SpriteKind.Enemy)
alien.setPosition(randint(10, 150), 0)
alien.vy = 20
})
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
for (let value of sprites.allOfKind(SpriteKind.Enemy)) {
value.vy = 0
}
})




















