Visual studio code inserting one picture but refusing to acknowledge the second one

Viewed 14

So i have inserted 2 pictures into vs code one of a spaceship and one of a bullet. The first one of the spaceship is successfully placed into vc code and placed on the screen using the blit function in pygame but the second one i placed like the first one. I tried changing the image but pygame refuses to place the image on the screen and it just says there is no .png file like that on vs code.

    import pygame
import sys

pygame.init()
fps = 30
fpsclock=pygame.time.Clock()
window = pygame.display.set_mode((600, 600))

x = 275
y = 275
color = (255,0,0)
ship_img = pygame.image.load('spaceship.png')
ship = pygame.transform.scale(ship_img,(32,32))
bullet_img = pygame.image.load('bullet (1).png')
bullet = pygame.transform.scale(bullet_img,(12,12))

# main application loop
run = True
while run:
    # limit frames per second
    fpsclock.tick(fps)

    # event loop
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    key_input = pygame.key.get_pressed() #key inputs
    if key_input[pygame.K_LEFT]:
        x -= 5
    if key_input[pygame.K_RIGHT]:
        x += 5

    # clear the display
    window.fill(0)



    window.blit(ship,(x,y))
    window.blit(bullet,90,90)
    # update the display
    pygame.display.flip()

pygame.quit()
exit()
0 Answers
Related