0
\$\begingroup\$

I have code which rotates a sprite:

@window.event
def on_key_press(symbol, modifiers):
    print('Rotating')

    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.

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

0

You must log in to answer this question.

Browse other questions tagged .