

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Sprites
incomplete
2: Draw Player
incomplete
3: Moving Around
incomplete
4: Moving
incomplete
5: Groups
incomplete
This lesson's interactive features are locked, please to keep using them
Now we want the ship to move back and forth with the W and S keys.
This is a course on programming, not vector math, so we've provided the math for you. All those words boil down to these lines of code:
unit_vector = pygame.Vector2(0, 1)
rotated_vector = unit_vector.rotate(self.rotation)
rotated_with_speed_vector = rotated_vector * PLAYER_SPEED * dt
self.position += rotated_with_speed_vector
unit_vector.rotate() returns a new vector – it doesn't modify the original. That's why we assign the result to rotated_vector.
If everything looks good, run and submit the CLI tests.