KRITSADA

Man on Fire Games

Jan 3rd, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let Fire: game.LedSprite = null
  2. let Man: game.LedSprite = null
  3. input.onButtonPressed(Button.A, function () {
  4.     Man.change(LedSpriteProperty.X, -1)
  5. })
  6. input.onButtonPressed(Button.B, function () {
  7.     Man.change(LedSpriteProperty.X, 1)
  8. })
  9. game.setScore(0)
  10. Fire = game.createSprite(Math.randomRange(0, 4), 0)
  11. Man = game.createSprite(2, 4)
  12. basic.forever(function () {
  13.     for (let i = 0; i < 4; i++) {
  14.         Fire.change(LedSpriteProperty.Y, 1)
  15.         basic.pause(150)
  16.     }
  17.     Fire.set(LedSpriteProperty.Y, 0)
  18.     Fire.set(LedSpriteProperty.X, Math.randomRange(0, 4))
  19.     basic.pause(150)
  20.     game.setScore(game.score() + 1)
  21. })
  22. basic.forever(function () {
  23.     if (Fire.isTouching(Man)) {
  24.         basic.showIcon(IconNames.Sad)
  25.         basic.showNumber(game.score())
  26.         basic.pause(1000)
  27.         game.setScore(0)
  28.     }
  29. })
Advertisement
Add Comment
Please, Sign In to add comment