コード例 #1
0
                #FIXED ERROR: screen cannot be behind player
                if (player.fromScreenD > 0.01):
                    player.fromScreenD -= 0.005
        #finds the difference to the previous call in ms
        dt = CLOCK.tick()
        #adds difference to time_elapsed(timer)
        time_elasped += dt
        #Sphere Generation(2 new spheres every second)
        if time_elasped > 2000:
            Sphere(
                [randint(-MAX, MAX),
                 randint(-MAX, MAX),
                 randint(-MAX, MAX)])
            time_elasped = 0
        #draws game screen
        RenderUtils.drawGame(shooting, dt)
    #Here's where all the code for the GAMEOVER screen lies
    elif (player.screenType == ScreenType.GAMEOVER):
        #draws gameover screen
        RenderUtils.drawGameOver(clicking)
        #FIXED BUG: sometimes the rocket sound would play after the game is over, this is to prevent that
        SOUND_ROCKET.stop()

        #FIXED BUG: resets keyPressed because sometimes pygame never calls the keyUp event,
        #leading the program to think the key is pressed when it isn't.
        keyPressed = []
    #Here's where all the code for the RULES screen lies
    elif (player.screenType == ScreenType.RULES):
        RenderUtils.drawRules(clicking)
        #FIXED BUG: resets keyPressed because sometimes pygame never calls the keyUp event,
        #leading the program to think the key is pressed when it isn't.