Something is wrong with my code.

Joined
Nov 1, 2023
Messages
1
Reaction score
0
File "/home/runner/Python/main.py", line 9
pizza_img = image.load('pizza.img') = image.load('images/vampire.png')
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to function call,
and this is what my code looks like:

import pygame
from pygame import *

pygame.init()

GAME_WINDOW = pygame.display.set_mode((900, 400))
pygame.display.set_caption('Attack of the Vampire Pizzas!')

pizza_img = image.load('pizza.img') = image.load('images/vampire.png')
surf = Surface.convert_alpha(pizza_img)
game_running = True

while game_running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_running = False
GAME_WINDOW.fill((255, 255, 255))
pygame.display.update()

pygame.quit().
I don't know what is going on, but the top message is my error message, and i don't know what it means
 
Joined
Jul 4, 2023
Messages
357
Reaction score
41
Try like this
Python:
pizza_img   = image.load('pizza.img')
vampire_img = image.load('images/vampire.png')
use separate variable for every single image.load

or for example
Python:
images = {}
images['pizza']   = image.load('pizza.img')
images['vampire'] = image.load('images/vampire.png')
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top