Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let x = 0
- let y = 0
- let px = 0
- let py = 0
- let score = 0
- let PastTime = 0
- basic.forever(function () {
- basic.clearScreen()
- led.plot(x, y)
- led.plot(px, py)
- if(control.millis() - PastTime > 3000)
- {
- PastTime = control.millis()
- px = randint(0, 4)
- py = randint(0, 4)
- }
- if(x == px && y == py)
- {
- px = randint(0,4)
- py = randint(0,4)
- score++
- console.log(score)
- }
- if(input.buttonIsPressed(Button.B))
- {
- if(x<4) x++
- }
- if(input.buttonIsPressed(Button.A))
- {
- if(x>0) x--
- }
- if(input.pinIsPressed(TouchPin.P0))
- {
- if(y<4) y++
- }
- if(input.pinIsPressed(TouchPin.P1))
- {
- if(y>0) y--
- }
- basic.pause(200)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement