Drag and drop behaviors problem

flameblue59

  • Posts: 113
Hi, I'm using  drag and drop behaviors but when I more than one object combined into one point and I do clicking on it. Those object are selected. How if I want to select one object only and let the other object there.

yoplalala

  • *
  • Posts: 1632
To select only one, click on shift. To copy use alt.

flameblue59

  • Posts: 113
I mean that drag and drop behavior, for example two objects placed have same size placed on same x & y coordinate. Let's say red & blue box. How can I click the red box then drag to another place within dragging the blue box. Using drag and drop behavior will drop everything which touching by our cursor.

yoplalala

  • *
  • Posts: 1632
you have to type shift at the same time you're clicking

letmethink

  • *
  • Posts: 2545
you have to type shift at the same time you're clicking

He isn't talking about the editor. He is talking about a game he is making.
~Letmethink

flameblue59

  • Posts: 113
@yoplala

I'm not talking about editor but the game which I made. I wish you could help me.

@letmethink

sure, I'm thinking about the default behavior of stencyl, do you know how choose for one actor, so the other actor won't be dragged when they're on the same point.

yoplalala

  • *
  • Posts: 1632
Oh.... my bad .....

Humm good question. You'll have to set a priority. The littler the object the higher the priority I think would be be good.
But now how would you set it ?
I'll see the drag behaviour and come back if I have an idea

yoplalala

  • *
  • Posts: 1632
Okay I have one, I 'm ginng to test it and post the modified code if it works

yoplalala

  • *
  • Posts: 1632
My method didn't work. I'll try to think about this later, if nobody answers. I have to go now

flameblue59

  • Posts: 113
thanks a lot for your help yoplalala, anyone can help me how to get out from this problem?.

LIBERADO

  • *
  • Posts: 2720
I think somewhere on my folders I have a behavior that I created some time ago to get what you want.
And I remember that it worked well.

The actors that you want to drag and drop, are they all the same actor type? Are they all in the same layer?

« Last Edit: December 18, 2014, 09:46:20 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

flameblue59

  • Posts: 113
They're on different actor and different layer. I want to make dress up game but when two or more objects combined in one position then I want to drag one of them. However, all of them are dragged.

yoplalala

  • *
  • Posts: 1632
Now thtat I look at my code, I did the stupidest mistake. But now it works.

So here is it :
I juste added a game attribute list.
When you click on a object it adds his width to the list.
We always remove from the list all the biggest number.
We can only move the object, if it has his width in the list.

Now you could change it. Not use the width but some other thing.
or used the width and the actor id if ever ther's two objects the same width ...

Hope it helps.

flameblue59

  • Posts: 113
I can't understand how to build it. How to do by editing the behavior drag and drop?. Should I do custom like it?.

letmethink

  • *
  • Posts: 2545
Create a new behaviour. Add the events and blocks (the ones you can't find by searching are normally attributes that you must add yourself). Test.
~Letmethink