Let me just check your working;
Quote: "(ScreenToWorldY(PointerY#) / GetVirtualHeight()"
(You actually don't need the ScreenToWorldY() part because pointerY() is a screen position and that is what you want to divide by the screen height)
- This returns a value between 0.0 (top of screen) and 1.0 (bottom of screen)
- multiply by 105 to get the range 0 (top) to 105 (bottom).
- add 300 to get the range 300 (top) and 405 (which equals 45) (bottom)
This looks correct if you want the angle to be set based on the absolute Y position of the mouse on screen. But since you asked the question, you want something else.
If you want to be able to click and drag, and the mouse angle moves from there, you need to store the Y position when the button was pressed and change the angle based on the difference.
something like this;
if getpointerpressed()
downY = getPointerY()
elseif getpointerstate()
moveY = getPointerY() - downY
if MouseHit = 1
// Code to convert moveY to Sprite Angle change goes here
endif
endif
moveY can be both positive (mouse moved down) or negative (mouse moved up), this is ok, and should be scaled and added to the current sprite angle.
I have not included code to convert this, you clearly know the maths and the amount of rotation will take some trial and error to get right.
You could start with;
newAngle = oldAngle + MoveY
and go from there