This is my first time posting on Stack Overflow so please let me know if I could be doing anything better for asking my question!
Here is the tutorial I am following timestamped to about where I was. I am using VSCode Python, and Pygame. https://youtu.be/UZg49z76cLw?t=1138
I have the file in the directory specified and I have made sure it is named correctly by copy-pasting it.
Whenever I run my code, the bg_surface does not show up on my screen. Before it said that it didn't exist, but I have put the full file address in and it stopped doing that, but still won't display the actual image. I would also like to get away from using the full file path as I won't be able to send it... import pygame, sys
pygame.init()#initiating pygame
screen = pygame.display.set_mode((576,1024))#Set canvas size
clock = pygame.time.Clock()
bg_surface = pygame.image.load('C:\\Users\\{my_name}\\MyPythonScripts\\Flapp\\assets\\background-day.png')
bg_surface = pygame.transform.scale2x(bg_surface)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()#Ends the game
sys.exit()#ends the program
screen.blit(bg_surface,(0,0))#Blit puts a surface on another surface
pygame.display.update#Update screen
clock.tick(120)#Set framerate
Things I have tried:
bg_surface = pygame.image.load('C:\\Users\\{my_name}\\MyPythonScripts\\Flapp\\assets\\background-day.png')
bg_surface = pygame.image.load('assets\\background-day.png')
bg_surface = pygame.image.load('assets/background-day.png')
bg_surface = pygame.image.load(r'assets/background-day.png')
bg_surface = pygame.image.load(r'assets\background-day.png')
bg_surface = pygame.image.load('assets\background-day.png')
And a lot of variations like those. Bonus points if you can tell me why I get:
Exception has occurred: SystemExit
File "C:\Users\Corbin\MyPythonScripts\Flapp\flapp.py", line 14, in <module>
sys.exit()#ends the program
When I close the program... Thanks!