0

I created a sprite, and it is working, but when I'm trying to create few instances, on different locations but I maybe don't know how. if I do:

o = copy.copy(object)

all the created instances gets the same attributes.

if I do:

o = copy.deepcopy(object)

I get an error:

screen.blit(o.image,o.rect)
pygame.error: display Surface quit

and if i create a new object it takes a lot of time and the game freezes for few seconds

what is the way to do that?

Nadav Barak
  • 177
  • 1
  • 3
  • 14
  • I think the easiest way for you to do this is to create a new sprite object using the same construction arguments (or current attributes) as for the sprite you are trying to copy. Apparently according to [pygame error display](http://stackoverflow.com/questions/1997710/pygame-error-display-surface-quit-why) the deepcopy is bugged.There is a POSSIBLE solution listed there. I am sadly not proficient in pygame, which is why my help can only go so far. Sorry. – trashy Apr 13 '17 at 21:51
  • @trashy ok thanks, but create a new object just freezes the game. thanks anyway – Nadav Barak Apr 13 '17 at 22:00
  • I'd probably need to know more code to be of better help. Sorry for not being a good helper. I hope you find your answer :) – trashy Apr 13 '17 at 22:04
  • In order to further help you, you will need to show us more of your code. – Taku Apr 14 '17 at 00:26
  • The fact that instantiating a new sprite is freezing the program for a few seconds is odd. Is the construction really number crunchy? – oxrock Apr 14 '17 at 16:27

0 Answers0