Object drag inside a circle

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Object drag inside a circle

Postby Surbhit29 » Fri Aug 17, 2012 6:29 am

I have an object Rectangle and it is draggable. The object is inside a circle. How can I restrict the path of the rectangle inside the circle, i.e the rectangle cannot be drag outside but within the circle.
Please tell me the code..
Surbhit29
 
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Re: Object drag inside a circle

Postby malte » Fri Aug 17, 2012 7:22 am

For a rectangle this is a little tricky. what you can do is constrain it in a way that can check if the location of your object (the middle point) is still within the circle. Would that help?
malte
 
Posts: 1096
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany

Re: Object drag inside a circle

Postby Surbhit29 » Fri Aug 17, 2012 7:36 am

I already tried that, but it didn't help. What if I use a rounded rectangle such that it matches the circumference of the circle. Can you help now..?
Also I am new at it. It will be great if you can post code for it.
Surbhit29
 
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Re: Object drag inside a circle

Postby Surbhit29 » Fri Aug 17, 2012 7:59 am

Also can it help if I use collision detection.. And then prevent the collision to occur
Surbhit29
 
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Re: Object drag inside a circle

Postby malte » Fri Aug 17, 2012 4:58 pm

Well, if you say you did that, it would be helpful if you told us what you tried. :-)
malte
 
Posts: 1096
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany

Re: Object drag inside a circle

Postby Surbhit29 » Sat Aug 18, 2012 2:58 pm

Actually I just followed the steps that came in Animation Engine 5 tutorial padf... ;)
Created 6 graphics, a label field and a button.... Now the first object that was created when collide with any of the five objects the label field shows the detection.....
Surbhit29
 
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm


Return to Animation Engine

Who is online

Users browsing this forum: No registered users and 2 guests