[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] help with float issue

On 09/11/2012 08:19, nick2003 wrote:
	def updateVelocity(self):
		'''calculates the velocity/movement to be done on x and y during move
		#update velocity
		vx = math.cos( self.heading )* self.speed
		vy = math.sin( self.heading )* self.speed

		self.velocity = (vx , vy )


Because this is a fragment of your code, it is difficult to speak definitively.

It looks like you are setting a taking the intended destination of your character and turning it into a heading. I suspect that is where your error is. Your character is walking near the destination, and then past it, because the bearing you are using is not accurate.

Either there is a bug in your .destination -> .heading code, or the .heading is not exact enough.

Peter Finlayson