Drag and drop behaviors problem

LIBERADO

  • *
  • Posts: 2719
@flameblue59, is your problem already solved?
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
I can't solve it. I dunno where to start. I just use drag and drop behavior as the default on stencyl. I think it needs some improvement to work as well.

LIBERADO

  • *
  • Posts: 2719
 ;) Don't worry, be happy:

<a href="http://www.filz.us/files/85f2ba08/37f/Drag_and_Drop_only_one.swf" target="_blank" class="new_win">http://www.filz.us/files/85f2ba08/37f/Drag_and_Drop_only_one.swf</a>
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
Hi, this is I'm looking for, may I know the events for the squre?. I'm so happy that you can do it :)

LIBERADO

  • *
  • Posts: 2719
Yeah... I have attached in this post the basic project file of this behavior, so you can download it and use it for your convenience. It works also with different actor types and different layers. In this example I have created 4 layers and have placed two actors in each layer.

Important requirements:

  • All selectable actors must be within the Group called SELECTABLE
  • If you place the actors in different layers, then you must maintain in the scene editor the natural order of the layers IDs creation: 0,1,2,3... (if you alter this order, the behavior won't work properly)
  • Do NOT place this behavior in the actors. It must be placed only in the scene.
;) That's all.

« Last Edit: December 20, 2014, 08:11:56 am 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
Thanks, it's worked perfectly. :)

Neotron

  • Posts: 475
WOW, thank you LIBERADO! You are a real expert! :)

Can you tell me one more thing?
If I want to stop dragging one of these actors if it is FULLY inside in a Region 0 how can I do that?
I tried to use "IF actor 1 is inside Region 0" then "Anchor Actor 1" but somehow I still can drag the actor from the Region 0...

« Last Edit: December 22, 2014, 12:46:10 pm by Neotron »

LIBERADO

  • *
  • Posts: 2719
@Neotron, your region is a circular region, or a square region?
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Neotron

  • Posts: 475
Mostly square, but sometimes poligonal. Square would be great if could work.

LIBERADO

  • *
  • Posts: 2719
Mostly square, but sometimes poligonal. Square would be great if could work.
For a square region, simply insert these blocks in my previously provided code:

« Last Edit: December 23, 2014, 05:54:27 am 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.

Neotron

  • Posts: 475
Thank you for the fast reply! :) Now actor released well after it is inside the Region, that is cool! However, I can still pull it out from there...isn't there any solution where the actor cannot dragable/movable anymore if it is inside the region?

LIBERADO

  • *
  • Posts: 2719
When I test my code, I can't drag or move the actor anymore if it is inside the region.
Make sure you have inserted the blocks in the correct place.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Neotron

  • Posts: 475
Liberado, you are right, you save my day again! :) Thank you and Merry Christmas! :)

Jaageri

  • Posts: 9
How can I open that attachment in stencyl * Drag and Drop only one Actor.stencyl (337.06 kB - downloaded 21 times.)

letmethink

  • *
  • Posts: 2545
Download it then click import game from within Stencyl. Select that game.
~Letmethink