コード例 #1
0
ファイル: main.py プロジェクト: thiagosantos1/Maze_Game
clock = pygame.time.Clock()
FPS = 24  # if we increase this number, the speed of character will be lower
total_frames = 0
total_frames_welcome = 0
pygame.mouse.set_visible(True)
# load and play background welcome page sound again
pygame.mixer.music.load('../Sounds/htd.wav')
pygame.mixer.music.play(-1)  # -1 put to loop the music forever

# Loop until the user clicks the close button.
done = False
Zombie.spawn()
while True:
    milliseconds = clock.tick(FPS)  # milliseconds passed since last frame
    clock_elapsed_seconds = milliseconds / 1000.0  # seconds passed since last frame (float)
    Tile.draw_tiles(screen)

    if survivor.isAlive:
        # interaction method from Interaction class. It control all events from the game
        interaction(screen, survivor)

        # move to the new direction, and also draw the player in the screen
        survivor.update(screen, clock_elapsed_seconds)

        # check if there's colision of any bullet, all the time
        Bullet.update(screen, survivor)

        Zombie.update(screen, survivor)
        Zombie.zombie_sounds(total_frames, FPS)

        # display the healthy of the player in the screen
コード例 #2
0
ファイル: main.py プロジェクト: thiagosantos1/Python-Game
    #otherwise and the player is alive, show and play the game
    elif survivor.isAlive:
        """
        if total_frames == 0:
            # stop the currectly sound to load and play the next one
            #pygame.mixer.music.stop()
            # load the background music
            pygame.mixer.music.load('../Sound_Effects/background2.wav')
            # play the background game music
            pygame.mixer.music.play(-1) # -1 put to loop the music forever
        """

        ####  Put the background image to screen
       
        Tile.draw_tiles(screen)

        princess.update(screen,total_frames, FPS)
     

        # interaction method from Interaction class. It control all events from the game
        interaction(screen, survivor)

        # move to the new direction, and also draw the player in the screen
        survivor.update(screen,clock_elapsed_seconds)

        # check if there's colision of any bullet, all the time
        Bullet.update(screen,survivor)

        # create and put a new zombie in the screen, controlling by the total of the frames
        Zombie.spawn(total_frames, FPS)