Commit 2cacdea0 authored by gem2578's avatar gem2578 Committed by Marcus M. Scheunemann

Added kick_range math

parent 18d7d91e
......@@ -20,6 +20,9 @@ class Ball(pygame.sprite.GroupSingle):
def rect(self):
return self.sprite.rect
def radius(self):
return self.sprite.radius
class Ball_Sprite(rs.Round):
max_speed = 5
......
......@@ -58,7 +58,8 @@ class Brain():
def pre_action(self, body):
self.ball = CupObject(ObjectType.BALL, body.ball.rect().center)
self.pos = pygame.math.Vector2(body.rect.center)
self.can_kick = self.pos.distance_to(self.ball.pos) < 30
kick_range = body.radius + body.ball.radius() + 5
self.can_kick = self.pos.distance_to(self.ball.pos) < kick_range
self.self_team = []
for player in body.self_team:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment