Drag and drop actor

Game Editor comments and discussion.

Drag and drop actor

Postby Clokio » Sun Jul 03, 2011 2:37 am

How to make a drag and drop actor for iPhone?
Clokio
 
Posts: 229
Joined: Tue May 17, 2011 2:18 pm
Score: 32 Give a positive score

Re: Drag and drop actor

Postby Jagmaster » Sun Jul 03, 2011 2:53 am

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.
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Drag and drop actor

Postby Clokio » Sun Jul 03, 2011 2:55 pm

It dose a mouse cursor which is great. But I want to click a actor, hold, drag and drop.
Clokio
 
Posts: 229
Joined: Tue May 17, 2011 2:18 pm
Score: 32 Give a positive score

Re: Drag and drop actor

Postby Game A Gogo » Sun Jul 03, 2011 3:31 pm

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest