Drag and drop...
![JlmC](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hello
How can i make my Actor to drag and object while im touching the screen, then, when i release the screen, my actor release the object.
thanks
How can i make my Actor to drag and object while im touching the screen, then, when i release the screen, my actor release the object.
thanks
Comments
Create 2 real attributes X and Y.
On actor 1;
Constrain game.X to self.X
Constrain game.Y to self.Y
---
When touch is pressed;
Constrain self.X to touch1.X
Constrain self.Y to touch1.Y
On actor 2;
When mouse button is down;
Constrain self.X to game.X+100
Constrain self.Y to game.Y
That should do it..
And on my 1st post it should be;
n actor 2;
When mouse button is down and overlaps or collides with actor1;
Constrain self.X to game.X+100
Constrain self.Y to game.Y
Nah, nevermind, i got it.
Thank you very much
I set up something very similar to this, only with mouse-down instead of touch-pressed at first, and I thought it worked, until I clicked outside of the Actor, and I realized a click anywhere on screen causes the Actor to jump to mouse position.
I have since started testing with touch-inside, and it seems to be working the way I expect, but I can't tell why your example works. Is it the difference between mouse and touch?
Also, as if that wasn't enough to ask, how does your example scale to if I had several actors with the same functionality on screen, and I wanted Multitouch to be able to arrange them separately?
You want touch is pressed and then mouse x and y because mouse x and y give a single touch point instead of figuring out which touch you are dragging with and pressed will keep the rules to follow your touch going even if you slide of the actor.
Now if you get into multiple actors at the same times needing to be drug around by different touches you will use all the same rules and then add in some multi touch rule like in the joystick demo so it knows which touch to follow.
Hope that somewhat answers your question
Aaron
___________________________________________________________________________________
Project Help from Tenrdrmer Click Here
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!!
Expanding Option Menu Template HERE!!
Tenrdrmer's Menu # 3 HERE!!
Menu #4 - Level Banners HERE!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
Yeah, that's great advice. Thanks!
I guess what I'm left wondering is, with Booth's instruction above, should I be able to use mouse-down instead of touch-pressed? Or would that give me the results I had before, where even clicking where the actor isn't makes the actor constrain? Is that just an inherent difference between mouse and touch?