I have code which rotates a sprite:

def on_key_press(symbol, modifiers):

    global player_sprite

    player_sprite.rotation += 1

    if player_sprite.rotation == 360:
        player_sprite.rotation = 0

However, this rotates the sprite in a manner I don't want: it changes its x and y position. I want it to remain in the same place -- it's a tank, and is not supposed to move when it turns. If, for instance, I do

player_sprite.rotation = 180

it not only faces the opposite direction, but is now far away from its original x and y coordinate.

How would I allow the sprite to rotate without changing its x and y?

Here's a link to my full code.

  • \$\begingroup\$ Is this answer useful? \$\endgroup\$ – Vaillancourt May 29 '19 at 19:23
  • \$\begingroup\$ Perfect! Merci mille fois! \$\endgroup\$ – user96931 May 29 '19 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.