Sunday, July 30, 2017

circling dot

let y = 0
let x = 0
let yDelta = 0
let xDelta = 0
basic.forever(() => {
    if (x == 0 && y == 0) {
        xDelta = 1
        yDelta = 0
    }
    if (x == 4 && y == 0) {
        xDelta = 0
        yDelta = 1
    }
    if (x == 4 && y == 4) {
        xDelta = -1
        yDelta = 0
    }
    if (x == 0 && y == 4) {
        xDelta = 0
        yDelta = -1
    }
    led.plot(x, y)
    basic.pause(100)
    led.unplot(x, y)
    x = x + xDelta
    y = y + yDelta
})

2 comments:

  1. Ber ber:
    let ring = 0
    let pop = 0
    let item = 0
    let mane = 0
    basic.forever(() => {
    mane = 0
    item = 0
    pop = 4
    ring = 4
    for (let i = 0; i < 4; i++) {
    led.plot(item, 0)
    basic.pause(100)
    led.unplot(item, 0)
    basic.pause(100)
    item = item + 1
    }
    for (let i = 0; i < 4; i++) {
    led.plot(4, mane)
    basic.pause(100)
    led.unplot(4, mane)
    mane = mane + 1
    basic.pause(100)
    }
    for (let i = 0; i < 4; i++) {
    led.plot(ring, 4)
    basic.pause(100)
    led.unplot(ring, 4)
    basic.pause(100)
    ring = ring - 1
    }
    for (let i = 0; i < 4; i++) {
    led.plot(0, pop)
    basic.pause(100)
    led.unplot(0, pop)
    basic.pause(100)
    pop = pop - 1
    }
    })

    ReplyDelete
  2. let item = 0
    input.onButtonPressed(Button.A, () => {
    item = item + 1
    })
    basic.forever(() => {
    basic.showNumber(item)
    if (item == 5) {
    basic.showString("boom")
    item = 0
    }
    })

    ReplyDelete