0

I was looking for a faster way to blit multiple objects in pygame than the traditional blitting method, in which you have an array or list, and you use a for loop to go and insert each image at its position.

Maybe there is a way of blitting the whole array at once, without having to go value by value throughout the whole array?

Thanks for the ideas and help!

2
  • 1
    Are you using Sprite groups? Commented Aug 10, 2015 at 18:43
  • No, I dont even know what that is. I have always used the blits, so for example: DisplaySurf.blit(myImage, (x,y)) Commented Aug 10, 2015 at 19:19

2 Answers 2

2

pygame.sprite.Group should do the trick! Also, pygame.sprite.Group has a draw function that draws all sprites in a group. https://www.pygame.org/docs/ref/sprite.html#pygame.sprite.Group

Sign up to request clarification or add additional context in comments.

Comments

1

use pygame.sprite.Group or multithread the blit method. In pygame 1.9.2alpha, it releases the python gil and allows multi-cpu rendering.

Also look up for pygame dirty rendering. Depending on what you want to draw, this can give you significant speed increase.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.