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

Re: [pygame] car game mechanics



You already have self.angle.  Why not just do your transform as a function of that?

a_deg = self.angle % 360
sprite = pygame.transform.rotate(self.original, a_deg * -1)

On Tue, Aug 30, 2011 at 7:21 AM, Nathan BIAGINI <nathan.open@xxxxxxxxx> wrote:
Doing something like :

a_rad = math.atan2(speedy, speedx)

?

I can turn 360 degrees yeah but it does not make proper rotation... i ll try to find something on the internet about 2d car physics.


2011/8/30 Weeble <clockworksaint@xxxxxxxxx>


On Aug 30, 2011 10:46 AM, "Nathan BIAGINI" <nathan.open@xxxxxxxxx> wrote:

>> a_rad = math.asin(speedx/SPEED)

Try math.atan2, feeding it both the x and y components of the velocity.