Beispiel #1
0
            # Level screen
            GAME.level_screen(LEVEL, LIVES, POINTS)
            KEYS.flush()
            KEYS.get_ch()

            # Game loop executes as time remains
            while GAME.get_t_remain() > 0:

                # FRAME stores the time remaining at the start of rendering
                # a frame, so as to calculate how long actually rendering it
                # took, and to maintain a framerate
                FRAME = GAME.get_t_remain()

                # repaint screen
                GAME.repaint()

                # poll for INPUT
                INPUT = ''
                if KEYS.kb_hit():
                    INPUT = KEYS.get_ch()

                # process INPUT
                CIN = keypress(INPUT)
                if CIN == -1:
                    STATUS = 2
                    break

                # run game mechanics for each cycle
                STATUS = GAME.change_state(CIN)
                if STATUS != 0:
Beispiel #2
0
            # Level screen
            game.levelScreen(level, lives, points)
            keys.flush()
            keys.getCh()

            # Game loop executes as time remains
            while game.getTRemain() > 0:

                # frame stores the time remaining at the start of rendering
                # a frame, so as to calculate how long actually rendering it
                # took, and to maintain a framerate
                frame = game.getTRemain()

                # repaint screen
                game.repaint()

                # poll for input
                input = ''
                if keys.kbHit():
                    input = keys.getCh()

                # process input
                cin = keypress(input)
                if cin == -1:
                    status = 2
                    break

                # run game mechanics for each cycle
                status = game.changeState(cin)
                if status != 0: