The image I have for the main character of the game will not show up on the screen.
I've tried making sure my gameDisplay.fill command comes before the jumper(x,y) function so that it doesn't overwrite the character. This seems to be the issue for every other thread I could find. It still doesn't work.
import sys
pygame.init()
windowWidth = 800
windowHeight = 600
black = (0,0,0)
white = (255,255,255)
x = (windowWidth * 0.45)
y = (windowHeight * 0.8)
def jumper(x,y):
gameDisplay.blit(jumperNormal, (x,y))
jumperNormal = pygame.image.load('jumper.png')
gameDisplay = pygame.display.set_mode((windowWidth, windowHeight))
pygame.display.set_caption("Jumperman")
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
gameDisplay.fill(white)
jumper(x, y)
pygame.display.flip()
clock.tick(60)
pygame.quit()
pygame.display.quit()
sys.exit()
What I'm trying to do is get the character to follow mouse coordinates on the screen, but first I need to get the image to appear on the screen. I'm following this guy's tutorial on Pygame: https://pythonprogramming.net/displaying-images-pygame/?completed=/pygame-python-3-part-1-intro/
I even copied and pasted his code into another program and the image didn't even pop up then, even though in his tutorial, it did.