Move a sprite at an angle in pygame
So if I had a rotated sprite in pygame, and I wanted to move it in the direction it was facing, how would I do that?
I don't want the movement to have any velocity or anything for now, just simple movement in the direction it's facing.
I'm not a pygame expert, but you can use trigonometry, and simple xy movement to move it in a direction.
from math import sin, cos direction = 0 # in radians!!! speed = 20 def move(): player.x += cos(direction) * speed player.y += sin(direction) * speed
you might need to tweak it a little (change the signs) since it will assume the player is facing horizontally