- # If enemy damaged but not destroyed, try to displace
- ang = track.angle + 2.5*(randreal()-0.5)
- temp = math.fabs(math.sin(ang))
- if math.fabs(math.cos(ang)) > temp:
- temp = math.fabs(math.cos(ang))
- xx = -math.sin(ang)/temp
- yy = math.cos(ang)/temp
- bumpto.i = int(w.i+xx+0.5)
- bumpto.j = int(w.j+yy+0.5)
+ displacement = course(track.bearing+randreal(-2.4,2.4), distance=2**0.5)
+ displacement.next()
+ bumpto = displacement.sector()