Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sprite not rendering
#3
(Oct-03-2019, 11:18 AM)metulburr Wrote: here is the modified section of your code. You need to add the draw method to the main game loop and put pygame.display.update() after that.
#sprites.draw(main_surface)
 
while True:
    main_surface.fill(WHITE)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
    
    sprites.update()
    sprites.draw(main_surface)
    pygame.display.update()
    clock.tick(fps)
Cheers for using classes and pygame rects. Wink

Thank you. I knew it was a simple mistake.
Reply


Messages In This Thread
Sprite not rendering - by Clunk_Head - Oct-03-2019, 10:27 AM
RE: Sprite not rendering - by metulburr - Oct-03-2019, 11:18 AM
RE: Sprite not rendering - by Clunk_Head - Oct-03-2019, 11:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Sprite image.get_rect() moves sprite to 0, 0 michael1789 2 4,634 Dec-13-2019, 08:37 PM
Last Post: michael1789
  Need help making a sprite GalaxyCoyote 4 3,303 Aug-11-2019, 09:12 PM
Last Post: metulburr
  moving a sprite pfaber11 3 2,633 May-15-2019, 12:52 PM
Last Post: pfaber11
  [PyGame] Need Help With Sprite ghost0fkarma 2 3,316 Jan-09-2018, 02:14 PM
Last Post: ghost0fkarma

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020