Я пытаюсь нарисовать стрелку на новой поверхности, чтобы затем повернуть ее, но когда я рисую ее на созданной мной новой поверхности, она не отображается.
Значок показываетвверх, когда он помещен на поверхность game_display, но не когда он помещен на поверхность player_icon
import pygame
pygame.init()
white = (255,255,255)
black = (0,0,0)
grey = (175,175,175)
display_width = 1365
display_height = 700
game_display = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption("First Person Shooter")
game_display.fill(black)
clock = pygame.time.Clock()
player_rotation = 0
player_icon_height = 15
player_icon_width = 15
def draw_map():
player_icon = pygame.Surface((player_icon_width, player_icon_height))
player_icon.fill(black)
player_icon.set_colorkey(black)
icon_position = [[int(player_location_x),int(player_location_y - (player_icon_height / 2))],[int(player_location_x - (player_icon_width / 2)),int(player_location_y + (player_icon_height / 2))],[int(player_location_x),int(player_location_y)],[int(player_location_x + (player_icon_width / 2)),int(player_location_y + (player_icon_height / 2))]]
#This next line is the issue
pygame.draw.polygon(player_icon, white, icon_position)
blitted = game_display.blit(player_icon, [player_location_x - (player_icon_width / 2), player_location_y - (player_icon_height / 2)])
player_icon_rotated = pygame.transform.rotate(player_icon, player_rotation)
player_icon_rotated_rect = player_icon_rotated.get_rect()
player_icon_rotated_rect.center = blitted.center
game_display.blit(player_icon_rotated, player_icon_rotated_rect)
pygame.display.flip()
pygame.display.update()
draw_map()
Он не отображается на новой поверхности, но если я заменил строку на:
pygame.draw.polygon(game_display, white, icon_position)
тогда нет проблемы