Greetings,
Well, I spend a whole afternoon trying to implement a simple navigation system using vectors. Finally it worked, here's a fragment of what I did (from a Spaceship class):
def moveForward(self):
self.center -= self.step * Vector2D(1,0).rotate(self.angle).invX()
self.rect.center = self.center.toPoint()
Basically, I use right and left arrow keys to rotate the spaceship to right or left direction, respectly. And, I have the previous fragmente code to move forward. Due the fact that (0,0) grows from left to right (x-coordinate) and from top to bottom, I have to invert the x-coordinate (invX() method) from the rotated vector in order to "correct" the spaceship navigation. Is there another way to make this simpler, for example, changing the origin or somewhat like that?
Thank you