from Path import * from World import * from Actor import * from Util import * class Player(): def __init__(self): self.pathlist = [Path()] self.pathCount = 0 self.invalidate = load_sound("a_lineInvalidate.wav") def update(self): "" for path in self.pathlist[:len(self.pathlist)-1]: if len(path.memberActors) == 0: self.pathlist.remove(path) def addMouseMotion(self, point): path = self.pathlist[len(self.pathlist)-1] path.append(point) # test actors for collision with rect around point for actor in World().actorList: pointrect = Rect(point,(0,0)) pointrect = pointrect.inflate(15,15) if actor.rect.colliderect(pointrect) and (path.leader==None or path.leader.teamID==actor.teamID): actor.path.delActor(actor) path.addActor(actor) actor.path = path actor.pathIndex = len(path.pointlist)-1 actor.state = Actor.FOLLOW def endPath(self): if len(self.pathlist[len(self.pathlist)-1].memberActors) == 0: self.invalidate.play() self.pathlist.append(Path()) def getPathlist(self): return self.pathlist