Question: I keep getting an error when I run this.. It says it cannot find my images or my sound but they are all located in
I keep getting an error when I run this.. It says it cannot find my images or my sound but they are all located in the same folder on the computer. This is python-pygame.
^^^^^^
import pygame
#Colors WHITE = (255,255,255) BLACK = (0,0,0)
pygame.init()
screen=pygame.display.set_mode([800,600])
#Caption for Game pygame.display.set_caption('Lab 10- Sound')
clock=pygame.time.Clock()
#Load Sound click_sound = pygame.mixer.Sound("watersound.wav") click_sound.play()
background_position = [0,0]
#Load background image, and person image background_image = pygame.image.load("backgroundimage.jpg") background_image = pygame.image.load("backgroundimage.jpg").convert() player_image = pygame.image.load("personimage.jpg").convert()
player_image.set_colorkey(BLACK)
done=FALSE
while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done=TRUE elif event.type == pygame.MOUSEBUTTONDOWN: click_sound.play() screen.blit(background_image, background_position) player_position=pygame.mouse.get_pos() x=player_position[0] y=player_position[1]
screen.blit(player_image, [x,y])
pygame.display.flip()
clock.tick(60) pygame.quit()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
