What i mean by the title is if i have an object that everytick gets its position to mouse.x and mouse.y. I know how to do that but how do i make object only move in a circle. So it has a fixed circle path that changes on the position of the mouse. In other words if there is a center point and object rotates around it but gets its position on the mouse position.
like this one?
Develop games in your browser. Powerful, performant & highly capable.
If you have a center location and a radius you can do this:
Sprite set X to centerX + radius*cos(angle(centerX,centerY,mouse.x,mouse.y))
Sprite set Y to centerY + radius*sin(angle(centerX,centerY,mouse.x,mouse.y))
Exactly like that i couldnt figure this out for the life of me