Jul-24-2024, 04:25 PM
(This post was last modified: Jul-24-2024, 05:04 PM by Yoriz.
Edit Reason: Added code tags
)
Pycharm can't read a file (which is in the directory), and it gives me the error message "FileNotFoundError: No file 'images.png' found in working directory '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/video /.venv'
this is the full code:
this is the full code:
import pygame pygame.init() WINDOW_WIDTH, WINDOW_HEIGHT = 1280, 720 pygame.display.set_caption("Space Shooter") display_surface = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) running = True surf = pygame.Surface((100, 200)) surf.fill("orange") x = 100 player_surface = pygame.image.load('images.png') while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False display_surface.fill('darkgray') x += 0.1 display_surface.blit(surf, (x, 150)) pygame.display.update() pygame.quit()