Exemplo n.º 1
0
def start():
    ls.init(dpad=True)

    try:
        game()
        end_game(winner=True)
    except:
        end_game(winner=False)
Exemplo n.º 2
0
# From https://github.com/pewpew-game/game-boulder/blob/master/boulder.py
#
import piper_light_show as ls

VOID = 0
WALL = 1
SOIL = 2
ROCK = 3
HERO = 4
GEM1 = 5
GEM2 = 6


ls.init(dpad=True)
screen = ls.Pix.from_iter((
    (1, 1, 1, 4, 1, 1, 1, 1),
    (1, 2, 2, 2, 3, 0, 2, 1),
    (1, 1, 3, 1, 2, 5, 2, 1),
    (1, 2, 2, 1, 2, 1, 1, 1),
    (1, 2, 0, 3, 2, 3, 2, 1),
    (1, 2, 0, 5, 2, 2, 2, 1),
    (1, 2, 2, 2, 2, 2, 2, 1),
    (1, 1, 1, 1, 1, 1, 1, 1),
))

blink = 1
dead = False
for y in range(8):
    for x in range(8):
        if screen.pixel(x, y) == 4:
            break;
Exemplo n.º 3
0
def red(intensity):
    return intensity*16
def green(intensity):
    return intensity*4
def blue(intensity):
    return intensity*1
def cyan(intensity):
    return green(intensity)+blue(intensity)
def magenta(intensity):
    return red(intensity)+blue(intensity)
def yellow(intensity):
    return red(intensity)+green(intensity)
def white(intensity):
    return red(intensity)+green(intensity)+blue(intensity)

ls.init()
screen = ls.Pix()

while True:
    ################################################################################
    # First Phase
    text = ls.Pix.from_text("Hello world!", color=ls.RED, bgcolor=ls.BLUE)
    screen.box(color=ls.BLUE, x=0, y=0, width=8, height=8)

    start = time.monotonic()
    while time.monotonic() - start < 5:
        for dx in range(-8, text.width):
            screen.blit(text, -dx, 1)
            ls.show(screen)
            ls.tick(1/12)