Advertisement
KRITSADA

Game Simple Touch

Feb 24th, 2021
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let coin = game.createSprite(randint(0, 4), randint(0, 4))
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement