View difference between Paste ID: p0R0CEvY and YvgeQQ8h
SHOW: | | - or go back to the newest paste.
1-
1+
2
let player = game.createSprite(2, 2)
3
game.setScore(0)
4
game.startCountdown(20000)
5
basic.forever(function () {
6
    if (player.isTouching(coin)) {
7
        game.setScore(game.score() + 1)
8
        coin.set(LedSpriteProperty.X, randint(0, 4))
9
        coin.set(LedSpriteProperty.Y, randint(0, 4))
10
    }
11
    if (input.acceleration(Dimension.Y) >= 0) {
12
        player.change(LedSpriteProperty.Y, 1)
13
        basic.pause(100)
14
    }
15
    if (input.acceleration(Dimension.Y) < 0) {
16
        player.change(LedSpriteProperty.Y, -1)
17
        basic.pause(100)
18
    }
19
    if (input.acceleration(Dimension.X) >= 0) {
20
        player.change(LedSpriteProperty.X, 1)
21
        basic.pause(100)
22
    }
23
    if (input.acceleration(Dimension.X) < 0) {
24
        player.change(LedSpriteProperty.X, -1)
25
        basic.pause(100)
26
    }
27
})
28