예제 #1
0
            mouse_x, mouse_y = event.pos
            my_character.shoot(DISPLAYSURF, WHITE, BLACK, my_character, mouse_x, mouse_y)

            # play sound
            sound_shoot.play()

            # update stats
            statistics.shots_fired += 1

        # quit on exit
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

    # draw my character
    my_character.drawCharacter(DISPLAYSURF, RED, background_color, mouse_x, mouse_y)

    # checking pressed keys for movement
    keys = pygame.key.get_pressed()
    # check legal moves
    legal_moves = my_character.getLegalMoves(config)
    if my_character.speed_count == my_character.speed:
        if "UP" in legal_moves:
            if keys[pygame.K_w]:
                my_character.y_coordinate -= 1
        if "DOWN" in legal_moves:
            if keys[pygame.K_s]:
                my_character.y_coordinate += 1
        if "RIGHT" in legal_moves:
            if keys[pygame.K_d]:
                my_character.x_coordinate += 1