I am currently making Pong in pygame. I am doing this by creating sprites from images that i have already made. I have ran into a problem, how ever, in that my sprites won't show up on my screen. I sent the script to a friend who ran it on his machine, and substituted with his own images, and it worked fine. Does anyone have an idea what could be causing the sprites to now show on my machine?
creating the class:
class Paddle(pygame.sprite.Sprite):
img = "paddle.jpg"
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load(self.img).convert()
self.rect = self.image.get_rect()
drawing it to the screen (as been added to the list called):
player1.place(10,10)
player2.place(50,50)
paddleList.draw(screen)
these are drawn outside the main loop. i understand that these wont update or anything as the game runs but they should still be statically placed on the screen. as stated before they showed on my friends machine. he used different images since i didnt send him the images i used to create the sprites, but they will not show up on my screen. I have even changed the images and nothing still shows.
EDIT: the main loop. all it does is continuesly draw the sprites. and has an exit event as of right now.
while True:
paddleList.draw(screen)
ballList.draw(screen)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit() #ensures will quit on all systems.
You need to call pygame.display.flip() in your main loop, or it shall never refresh the screen. Replace the main loop with this: