0

Is this a good way to find the angle of the mouse to a set position in pygame

I am trying to figure out trigonometry so i can use it in some projects, and this part of it in particular seems like it would help a lot in making games. Are there any other/ better methods to do this? https://sololearn.com/compiler-playground/cgR23FqZuYtF/?ref=app

5th May 2024, 12:28 PM
Christos fiotakis
Christos fiotakis - avatar
1 Antwort
+ 2
At a quick glance, that looks normal. In case it’s what you were asking, yes, trigonometry is what you need here. One thing I noticed he doesn’t deal with is that some of the trigonometry functions will trim off increments of either 90 or 180° if I remember right, so you have to do some checking as to if any axes are negative to add those back in. I don’t remember which ones, but his program will show you the angle changing in real time, so you can figure it out from that.
5th May 2024, 2:04 PM
Wilbur Jaywright
Wilbur Jaywright - avatar