Guest User

Untitled

a guest
Feb 23rd, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. let ey = 0
  2. let ex = 0
  3. let yy = 0
  4. let xx = 0
  5. xx = 2
  6. yy = 2
  7. led.plot(2, 2)
  8. ex = Math.randomRange(0, 4)
  9. ey = Math.randomRange(0, 4)
  10. basic.forever(function () {
  11. if (input.acceleration(Dimension.X) < -50) {
  12. if (xx > 0) {
  13. led.unplot(xx, yy)
  14. xx += -1
  15. basic.pause(100)
  16. }
  17. }
  18. if (input.acceleration(Dimension.X) > 50) {
  19. if (xx < 4) {
  20. led.unplot(xx, yy)
  21. xx += 1
  22. basic.pause(100)
  23. }
  24. }
  25. if (input.acceleration(Dimension.Y) > 50) {
  26. if (yy < 4) {
  27. led.unplot(xx, yy)
  28. yy += 1
  29. basic.pause(100)
  30. }
  31. }
  32. if (input.acceleration(Dimension.Y) < -50) {
  33. if (yy > 0) {
  34. led.unplot(xx, yy)
  35. yy += -1
  36. basic.pause(100)
  37. }
  38. }
  39. if (ex == xx && ey == yy) {
  40. led.unplot(ex, ey)
  41. ex = Math.randomRange(0, 4)
  42. ey = Math.randomRange(0, 4)
  43. }
  44. led.plot(xx, yy)
  45. basic.pause(100)
  46. led.unplot(xx, yy)
  47. basic.pause(100)
  48. led.plot(ex, ey)
  49. basic.pause(100)
  50. })
Advertisement
Add Comment
Please, Sign In to add comment