Suncat2000
0
Q:

How to make an image in pygame

# Ufo.png is just a random download. You are supposed to put the file name over there, in quotation marks
pygame.image.load('ufo.png')
4
import pygame as pg

pg.init()

screen = pg.display.set_mode((display_width,display_height))

# load the image in with file name
yourImg = pg.image.load('yourImg.png')
def showImg(x,y):
  	# pass the image and x,y values to screen
    screen.blit(yourImg, (x,y))
    
done = False
while not done:
  	for event in pg.event.get():
      if event.type == pg.QUIT:
        pg.quit()
        quit()
    # call the function
	showImg(10,10)
    pg.display.update()
pg.quit()
quit()
0

New to Communities?

Join the community