def update(): global gameOver if stage[shooterPosition][0] == 1: gameOver = True if (t % 240 - score) == 0: shift() kit.clear() renderStage() kit.set_pixel(0, shooterPosition, [8, 8, 8]) kit.render()
def draw_treasure_map(p_pos, t_pos): kit.clear() p_quad = calc_w_pos(p_pos[0], p_pos[1]) rect(p_quad[0] * 4, p_quad[1] * 2, 4, 2, colors['player']) for t in t_pos: t_quad = calc_w_pos(t[0], t[1]) rect(t_quad[0] * 4, t_quad[1] * 2, 4, 2, colors['treasure']) for i in range(0, score): kit.set_pixel(i % 16, int(i / 16), colors['heading']) kit.render() sleep(1)
t_pos.append(place_treasure(world)) elif score < 23: if len(t_pos) == 0: for i in range(0, 3): t_pos.append(place_treasure(world)) n_pos = place_treasure(world) npcs.append([n_pos[0], n_pos[1], 1]) elif score < 32: if len(t_pos) == 0: for i in range(0, 4): t_pos.append(place_treasure(world)) for i in range(0, 2): n_pos = place_treasure(world) npcs.append([n_pos[0], n_pos[1], 1]) else: kit.clear() while True: kit.set_pixel(random(0, 15), random( 0, 7), [random(0, 30), random(0, 30), random(0, 30)]) kit.render() sleep(0.01) draw_treasure_map(p_pos, t_pos) kit.render() sleep(0.1) kit.clear() for i in range(0, score): kit.set_pixel(i % 16, int(i / 16), colors['heading']) kit.render()
def clearScreen(): for i in range(0, 16): for j in range(0, 8): kit.set_pixel(15 - i, j, [10, 10, 10]) kit.render() sleep(0.2)
def cover(): kit.clear() renderStage() kit.render()