added collision
This commit is contained in:
parent
f0d7ef7cce
commit
306f282d15
2 changed files with 11 additions and 1 deletions
|
|
@ -13,6 +13,13 @@ class CircleShape(pygame.sprite.Sprite):
|
|||
self.velocity = pygame.Vector2(0, 0)
|
||||
self.radius = radius
|
||||
|
||||
def is_colided(self,other_circle):
|
||||
distance = self.position.distance_to(other_circle.position)
|
||||
if other_circle.radius + self.radius <= distance:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def draw(self, screen):
|
||||
# sub-classes must override
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue