On 2021-03-07 03:01, Quentin Bock wrote:
#Space Invaders!
#Title and Icon
pygame.display.set_caption("Space Invaders")
icon = pygame.image.load('space-invaders.png')
pygame.display.set_icon(icon)
#Player
player_Image = pygame.image.load('player.png')
player_X = 370
player_Y = 480
def player():
screen.blit(player_Image, player_X, player_Y)
The position should be given as a 2-tuple, not as 2 separate parameters.
The line should be:
screen.blit(player_Image, (player_X, player_Y))
#Game Loop
pygame.init()
screen = pygame.display.set_mode((800, 600))
running = True
while running:
screen.fill((128, 128, 128))
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
player()
pygame.display.update()
The window will not display the icon, saying, "invalid destination for blit"
Is this an indentation error? I don't understand why this position
would be invalid.
link to tutorial I'm following:
https://www.youtube.com/watch?v=FfWpgLFMI7w
--
https://mail.python.org/mailman/listinfo/python-list