コード例 #1
0
        #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.
        keyPressed = []
    #updates screen
    pygame.display.flip()
#quits mixer and pygame
pygame.mixer.quit()
pygame.quit()