Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18702

How to fix circle's rotation?

$
0
0

A fragment of my python + pygame code:

    y_vector = math.cos(angle) * 15    x_vector = math.sin(angle) * 15    pointer_x = xpos + x_vector    pointer_y = ypos + y_vector    pygame.draw.circle(screen, "Red", (pointer_x, pointer_y), 6)    print(f"player pos:{xpos},{ypos}\nangle:{angle}\n pointer pos:{pointer_x},{pointer_y}")

it should make red circle orbit player, player can increment and decrement angle variable and red circle should follow this angle, but on test it does something very strange(i attached an image).What should beWhat it does(green dot is a player)

I believe that something wrong with coordinate systems: it works fine on classical system but not on pygame's. I tried to fix that but it still outputs very strange results. How do i should translate from classical coordinates system to pygame's? Big thanks.


Viewing all articles
Browse latest Browse all 18702

Trending Articles