コード例 #1
0
def update():
    global gameOver
    if stage[shooterPosition][0] != 0:
        gameOver = True
    kit.clear()
    renderStage()
    kit.set_pixel(0, shooterPosition, colors[currentColor])
    kit.render()
コード例 #2
0
def update():
    global gameOver
    if stage[shooterPosition][0] == 1:
        gameOver = True
    if (t % 240 - score) == 0:
        shift()
    kit.clear()
    renderStage()
    kit.setPixel(0, shooterPosition, [8, 8, 8])
    kit.render()
コード例 #3
0
def loop():
    global t
    t = t + 1
    kit.check_controls()
    if not gameOver:
        if t % int(level) == 0:
            updateBall()
        kit.clear()
        renderFrame()
        kit.render()
    else:
        kit.set_background([10, 10, 0])
        for i in range(0, score):
            kit.set_pixel(i % 16, int(i / 16), [10, 0, 0])
        kit.render()
コード例 #4
0
    ysign = 1 if dy > 0 else -1

    dx = abs(dx)
    dy = abs(dy)

    if dx > dy:
        xx, xy, yx, yy = xsign, 0, 0, ysign
    else:
        dx, dy = dy, dx
        xx, xy, yx, yy = 0, ysign, xsign, 0

    D = 2 * dy - dx
    y = 0

    for x in range(dx + 1):
        yield x1 + x * xx + y * yx, y1 + x * xy + y * yy
        if D > 0:
            y += 1
            D -= dx
        D += dy


def line(x1, y1, x2, y2, color):
    for pixel in bresenham(x1, y1, x2, y2):
        kit.setPixel(pixel[0], pixel[1], color)
    kit.render()


kit.clear()
line(2, 2, 5, 5, [10, 0, 0])
コード例 #5
0
def render():
    kit.clear()
    renderStage()
    renderPixel()
    renderPixelHeading()
    kit.render()
コード例 #6
0
def cover():
    kit.clear([0, 0, 0])
    renderStage()
    kit.render()
コード例 #7
0
def cover():
    kit.clear()
    renderStage()
    kit.render()