I am at the very beginning of learning pygame, and I have an image [https://imgur.com/a/t24fNiA], and it moves from side to side. With it being a circle, I want it to rotate/roll a little bit each time it moves.
I have checked online about this, but couldn't really apply it to my own work. so far all I have is def rotcenter(image, angle):
. I don't really know where to go from here.
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
xchange = -5
# image rotates
elif event.key == pygame.K_RIGHT:
xchange = 5
# image rotates
In place of the # image rotates
, I would like to call a subroutine which rotates the image by a certain angle.
Ideally it shouldn't go to far because each change in x is 5, but hopefully someone can help me to come up with a solution. Please try to simplify/explain stuff which I might not understand, I have only been using pygame for the best part of about 40 minutes, mainly reading tutorials.
Any help would be appreciated! Thanks :)