0

This is my first or second attempt (im not sure) at trying to use an image in pygame, and the image im using isnt blitting onto the surface no matter what i try, please help.

Game Folder

import pygame
import random
import os

pygame.mixer.init()

def Main():
    PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)) + '\Assets')
    print(PATH)
    WINDOW = pygame.display.set_mode((700, 700))

    Diamond = pygame.image.load(PATH + '\Images\Diamond.png')
    PickupSound = pygame.mixer.Sound(PATH + '\Audio\CollectDiamond.wav')
    pygame.mixer.Sound.play(PickupSound)

    while True:
        WINDOW.fill((125, 125, 200))
        Diamond.blit(WINDOW, (200, 200))
        pygame.display.update()

Main()
SquidR
  • 27
  • 4

1 Answers1

1

Testing out your initial code, I believe you need to basically correct one line. Instead of:

Diamond.blit(WINDOW, (200, 200))

The line of code should be:

WINDOW.blit(Diamond, (200, 200))

When I went out and grabbed a generic "png" file, I got the following sample screen.

Diamond

Give that a try.

NoDakker
  • 3,390
  • 1
  • 10
  • 11