I'm trying to learn how to use pygame, I've created one basic game and a couple of other tests. I've managed to pull a small bit of code together from bits on the internet.
When I run it, a car points towards the mouse; but I couldn't find anything on testing for what direction an image is pointing, or setting the direction to something else. Say:
def set_direction(image, angle):
'Set the direction of an image'
def direction(image):
'returns the direction of the image'
I'm really not sure what I'd do if I want to point an image somewhere.
Sorry if duplicate, I couldn't find anything else.
You really have to keep track of the current angle of your car manually (e.g. an int). You cannot just make an image return it's angle, as it doesn't have one.
To rotate an Image, have a look at pygame.transform.rotate().