Page 1 of 1

Drag and drop actor

PostPosted: Sun Jul 03, 2011 2:37 am
by Clokio
How to make a drag and drop actor for iPhone?

Re: Drag and drop actor

PostPosted: Sun Jul 03, 2011 2:53 am
by Jagmaster
Did you try Mouse down (Drag Enable)? This is built into the mouse down event and cannot be called independently, and if you do, you have to have some kind of script. you can cheat this way:
Script
Code: Select all
//Haha, no script! In your face!

Only do this if you are lazy with typing XD. If this does not work for you, try this:
Mouse down
Code: Select all
FollowMouse("Event Actor", BOTH_AXIS);

Mouse up
Code: Select all
FollowMouse("Event Actor", NONE_AXIS);

I like this method because you can specify which coordinate axis you want the actor to follow.
I hope this works with Iphone, if it doesn't, I don't know what will.

Re: Drag and drop actor

PostPosted: Sun Jul 03, 2011 2:55 pm
by Clokio
It dose a mouse cursor which is great. But I want to click a actor, hold, drag and drop.

Re: Drag and drop actor

PostPosted: Sun Jul 03, 2011 3:31 pm
by Game A Gogo
Create 3 Actor variable named "MouseB" and "Initx" and "Inity"
On mouse down:
Code: Select all
MouseB=1;
Initx=xscreen-xmouse;
Inity=yscreen-ymouse;

On mouse up:
Code: Select all
MouseB=0;


now in draw actor:
Code: Select all
if(MouseB)
{
    xscreen=xmouse+Initx;
    yscreen=ymouse+Inity;
}



Voila!