Need some help with trig :3

So, what I want to do here is to be able to switch between mouse and arrow controls. I got the saves down, and now I just need the math. With the arrow keys, left and right change the angle, but I’m stuck on the mouse and need to figure out how to set the mouse position to the angle of the deadeye. Any help @JR01 or anybody who knows trig?

Here’s the link:

1 Like

Try using my AngleTo bundle:
Flowlab Game Creator - Point-at & Angle-to Example


Got it. Thanks! :grin:

1 Like

Ok nvm it kinda broke everything :no_mouth:
It just spazzed back and forth, and when I tried deleting the extracts and A-B things, it almost worked but not quite…

1 Like

You need to find the difference of the coords of the cursor and the player, then use Math.tan(y/x). Put the angle from tan into sin and cos to find the final y and x respectively

The 8 and -8 are for the magnitude of how far you want the deadeye from the player


Actually I’m looking at the code now, so you have the player always pointing at the aim object.

So what you want to do is re-add my AngleTo bundle (because you removed the extractors) and change the extractor to the player object (Ratatio).


Next you want to add an expression to match the rotation to the max rotation you used. Basically needing to convert 360 degrees into 64 numbers (because rotation loops on 64). That expression will look like this: A*(8/45)

And then Mouse Rotation should work.


Finally someone reveals why angles are always so weird TT

1 Like

Its what you set the sin and cos min and max to be ().

I could probably make a bundle for that :thinking:

1 Like