def onDrawMapObjects(self, surface): sourcePos = self.origin for leg in self.boat.plot.data: delta = Point.fromVector(leg.dir.angle, leg.dist) targetPos = sourcePos + delta self.drawLeg(surface, sourcePos, targetPos, False) sourcePos = targetPos screenPos = Point(self.window.mouseX, self.window.mouseY) targetPos = screenPos - Point(*self.map.rcMap.topleft) self.drawLeg(surface, sourcePos, targetPos, True)
def __init__(self, game, window, ship): self.game = game self.window = window self.map = window.map # Set the source self.boat = ship self.origin = self.game.ocean.getCoord(ship) + Point(0.5, -0.5) self.sourcePos = self.origin if len(ship.plot): ship.owner.onBoatRestarted(ship) for leg in ship.plot: delta = Point.fromVector(leg.dir.angle, leg.dist) self.sourcePos += delta