Hi @puzzler2018,
Thanks for the quick response, having reviewed your code and trying it, the only real difference I see between mine and yours is that you use
GetPointerX() &
GetPointerY() to obtain the mouse position opposed to me using
GetRawMouseX() &
GetRawMouseY()..
Is there any benefit to doing it this way ? Aside from the obvious it will work for multiple devices, which at the minute I only plan to make for Windows platform.
Having tried it the program acts exactly the same and has no difference in result.
Kind Regards
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Since the last post I decided to have a little play with the code, and it seems to be a little better in following the mouse pointer although I feel its still a bit buggy..
Updated Code
Function RotatePlayer()
// fetch the current mouse x,y co-ords
mouseX = GetRawMouseX()
mouseY = GetRawMouseY()
// Fetch Player x,y co-ords by the offset
playerX = GetSpriteXByOffset(PLAYER_IMAGE_INDEX)
playerY = GetSpriteYByOffset(PLAYER_IMAGE_INDEX)
// Rotation
rotationAngle = ATanFull(mouseX - PlayerX, mouseY - playerY)
rotationAngle = rotationAngle - 90
// Player Rotation - Face Mouse Pointer
SetSpriteAngle(PLAYER_IMAGE_INDEX, rotationAngle)
// Debug Use Only!
Print("Player Rotation Angle: " + Str(rotationAngle))
EndFunction
New GIF demonstrating the new rotation to mouse pointer follow, note if I get close the the player it goes all crazy..
Thanks