Skip to content

Commit

Permalink
Powerup picking
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoisset committed Jul 9, 2012
1 parent 188fa45 commit fe447a7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bots/darninator.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,16 @@ def angle(self):
def patrol(self):
if self.location.real < 0: # Game hasn't started, do nothing
return
# powerup?
for item in self.proximity:
if item["object_type"] == "powerup":
d = complex(*item["position"])
if self.line_of_sight(d):
self.dest = d
break
# Pick a destination, far away, but reachable
while abs(self.location - self.dest) < NEAR_DISTANCE or not self.line_of_sight(self.dest):
#print F(self.dest), "didn't work. Trying",
self.dest = random.choice (LOCATIONS)
#print F(self.dest)
#if abs(self.location - self.dest) >= NEAR_DISTANCE and self.line_of_sight(self.dest):
# print "Going ", F(self.location), "to", F(self.dest)
# Find where I should aim at = Vector to target + compensation for velocity
target = (self.dest-self.location) - VELOCITY_COMPENSATE*self.velocity
self.aim(target)
Expand Down

0 comments on commit fe447a7

Please sign in to comment.