Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let ey = 0
- let ex = 0
- let yy = 0
- let xx = 0
- xx = 2
- yy = 2
- led.plot(2, 2)
- ex = Math.randomRange(0, 4)
- ey = Math.randomRange(0, 4)
- basic.forever(function () {
- if (input.acceleration(Dimension.X) < -50) {
- if (xx > 0) {
- led.unplot(xx, yy)
- xx += -1
- basic.pause(100)
- }
- }
- if (input.acceleration(Dimension.X) > 50) {
- if (xx < 4) {
- led.unplot(xx, yy)
- xx += 1
- basic.pause(100)
- }
- }
- if (input.acceleration(Dimension.Y) > 50) {
- if (yy < 4) {
- led.unplot(xx, yy)
- yy += 1
- basic.pause(100)
- }
- }
- if (input.acceleration(Dimension.Y) < -50) {
- if (yy > 0) {
- led.unplot(xx, yy)
- yy += -1
- basic.pause(100)
- }
- }
- if (ex == xx && ey == yy) {
- led.unplot(ex, ey)
- ex = Math.randomRange(0, 4)
- ey = Math.randomRange(0, 4)
- }
- led.plot(xx, yy)
- basic.pause(100)
- led.unplot(xx, yy)
- basic.pause(100)
- led.plot(ex, ey)
- basic.pause(100)
- })
Add Comment
Please, Sign In to add comment