How to use sprite groups in pygame

后端 未结 4 1778
执念已碎
执念已碎 2020-12-19 04:12

So I\'ve gotten to the point in my program where I need to create a group for some sprites that the player can collide with without dying (like some other sprites I may have

4条回答
  •  北海茫月
    2020-12-19 05:01

    Easier yet you can pass the sprites directly on to the constructor:

    gems = pygame.sprite.Group(gem1, gem2)
    

提交回复
热议问题