def splash(w, h): for n in range(0, w, 20): yield from rectangle(x=n, y=0, w=10, h=h, fill=True) yield from rectangle(x=0, y=17, w=w, h=30, fill=False) yield from text(x=0, y=20, string='PONG!', size=3) yield from text(x=80, y=20, string='Click to') yield from text(x=80, y=30, string='START!')
def view(state): if state['state'] == GAME_NOT_STARTED: yield from splash(w=state['display']['width'], h=state['display']['height']) else: yield from deck(player=state['player'], ai=state['ai'], ball_data=state['ball']) if state['state'] == GAME_WIN: yield from text(0, 20, "YOU WIN!", 3) elif state['state'] == GAME_LOSE: yield from text(0, 20, "YOU LOSE!", 3)
def game_over(): yield from text(x=0, y=20, string='GAMEOVER', size=3)
def splash(w, h): for n in range(0, w, 20): yield from rectangle(x=n, y=0, w=10, h=h, fill=True) yield from rectangle(x=0, y=17, w=w, h=30, fill=False) yield from text(x=0, y=20, string='BREAKOUT', size=3)