def move_up(self): if not self.collision: #cannot jump in the air return False subprocess.Popen(["python", self.path + os.sep + "aud" + os.sep + "jump.py"]) (P, Q) = self.collision (x, y) = p.vsub(Q, P) if self.collision and x <= 0 and abs(x) >= abs(y): #surface angle leq 45, can jump impDir = p.orthogonal((x, y)) self.v = p.vadd(self.v, p.fixNorm(impDir, self.maxJump)) self.collision = False return True
def calibrateParticleEdge(self, wp, P, Q, R): if wp.isParticle: base = p.vsub(Q, P) perPt = p.perPt(P, Q, R) #ensure particle not in wall (wp.x, wp.y) = p.vadd(perPt, p.fixNorm(p.orthogonal(base), wp.r))