Beispiel #1
0
	def moveAndCollide(self, vector, collidables, slide=True, origVec=None, surface=None):
		if origVec == None:
			origVec = vector
		self.move(vector)
		for c in collidables:
			if self.detectCollision(c) is not None:
				self.move(vector.getNegative())
				if vector.magnitude >= 1.0:
					self.moveAndCollide(vector.multiplyByScalar(0.5), collidables, slide, origVec)
				elif slide == True:
					#self.slide(origVec,c)
					self.moveAndCollide(self.slide(origVec, c), collidables, False)
Beispiel #2
0
	def moveAndCollide(self, vector, collidables, slide=True, origVec=None):
		if origVec == None:
			origVec = vector
		self.move(vector)
		for c in collidables:
			isctn = self.detectCollision(c)
			if isctn is not None:
				self.move(vector.getNegative())
				if vector.magnitude > 1.0:
					toReturn = self.moveAndCollide(vector.multiplyByScalar(0.5), collidables, slide, origVec)
				elif slide == True:
					self.moveAndCollide(self.slide(origVec, c), collidables, False)
				return True