How do I make object move in a circle with my mouse

Get help using Construct 2

Post » Thu Sep 18, 2014 1:56 pm

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.
B
9
S
2
Posts: 18
Reputation: 569

Post » Thu Sep 18, 2014 5:28 pm

like this one?
www[dot]scirra[dot]com/tutorials/667/eyes-of-monster-follow-mouse-cursor
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
3
Posts: 292
Reputation: 7,188

Post » Thu Sep 18, 2014 5:35 pm

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))
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Thu Sep 18, 2014 5:37 pm

Exactly like that :D. I could kiss your right now thankkk youuu soo much :D i couldnt figure this out for the life of me
B
9
S
2
Posts: 18
Reputation: 569


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests