简体   繁体   中英

Is checking a pixel colour more efficient than using pygames collide function

I want to make a game such that you have a circle moving around and several other circles chasing it. In order to destroy the enemies you must hit spacebar which draws a circle with a gradient that destroys nearby enemies.

I was wondering if it is more efficient to check to see if the colour at the top bottom left and right is more efficient than checking the collision of the circles. Or is there a better way all together to do this more efficiently.

To be completely honest if you are using pygame 1.8.1 or later and since you are using circles I would try using pygame.Sprite.collide_circle()

Here's where you can find the documentation for it https://www.pygame.org/docs/ref/sprite.html#pygame.sprite.collide_circle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM