示例#1
0
def plane_contril():
    global plane_cur_pos
    global plane_last_pos
    global t_count
    global user_score
    global game_status
    global barrier_list

    while True:
        if game_status == GAME_WAIT_TO_PALY:
            codey.face('00000000000003e60300000000000000')
            if codey.is_button("C"):
                game_status = GAME_PLAYING
                codey.clear()
        elif game_status == GAME_OVER:
            codey.show(user_score)
            for i in range(BARRIER_MAX_NUM):
                barrier_list[i][0] = False
            if codey.is_button("C"):
                game_status = GAME_PLAYING
                plane_cur_pos = 7
                plane_last_pos = 6
                user_score = 0
                codey.clear()
        elif game_status == GAME_PLAYING:
            plane_run(plane_cur_pos, plane_last_pos)
            plane_last_pos = plane_cur_pos
            if codey.is_button("C"):
                shoot()
            if t_count >= 10:
                barrier_control()
                t_count = 0
            t_count += 1
            time.sleep(0.020)
示例#2
0
        codey.pixel(food_point[0], food_point[1])

        if count % run_speed == 0:
            sanke_move(move_dir)  
            move_dir_last = move_dir
        show_snake()

        if codey.is_button("A"):
            game_status = GAME_OVER

    elif game_status == GAME_OVER:
        codey.show(len(snake_list) - 3)
        if codey.is_button("C"):
            snake_list = [[0, 0], [2, 3], [3, 3]]
            codey.clear()
            food_point = [0, 0]
            show_snake()
            print("create result", point_create())
            game_status = GAME_PLAYING

    elif game_status == GAME_PASS:
        codey.show("OK")
        if codey.is_button("C"):
            snake_list = [[0, 0], [2, 3], [3, 3]]
            codey.clear()
            food_point = [0, 0]
            print("create result", point_create())
            show_snake()
            game_status = GAME_PLAYING
    elif game_status == GAME_LEVEL_PASS: