Permalink
Browse files

Powerup picking

  • Loading branch information...
dmoisset committed Jul 9, 2012
1 parent 188fa45 commit fe447a7dac638e34880ceca7e7407093470cb969
Showing with 7 additions and 4 deletions.
  1. +7 −4 bots/darninator.py
View
@@ -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)

0 comments on commit fe447a7

Please sign in to comment.