Multi Drag and Drop at once?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello!

    I am working on an inventory, but I would like that inventory to be able to move! So, easy solution, right? Make the inventory drag and drop!

    But, I need all the objects within the inventory to do the exact same thing at the same time, and I am having trouble...

    Essentially, drag the inventory, and then inventory items are dragged with it.

    Does anyone know how to do this?

    Thanks in advance!!!

    Logan Apple

    X Star

    Please login to see this link.

  • Really awesome! Hey, I was curious, instead of positioning is there a way to have a group move at once? So instead of individual X and Y positioning, could there be a cleaner way of doing it?

    Just curious! If you don't know, that's A okay! :)

    Logan Apple

    X Star

    Please login to see this link.

  • I'm sure there's a way of doing it as a group, but my example is only 4 events as it sits. Maybe a more advanced coder will chime in with a cleaner type of example.

    [SIGPIC][/SIGPIC]Please login to see this link.
    Please login to see this link.

    Edited once, last by KLiK-iT (February 25, 2013 at 11:17 AM).

  • As far as i know there is no Move-the-Group-feature in MMF2.
    You have to build it yourself.

    According to the link i've posted above here is a revised example of
    Drag & Dropping groups without Fast Loop or Spread Values and with
    a custom Drag&Drop movement:

    Please login to see this attachment.

    The Drag&Drop object you need only for the items,
    to see that you can have individual positions,
    they move also when outside the box.


    edit: Happy 300th Post! :D

  • It's funny that this thread is up right now, because I'm building a level editor and needed a way to group objects so I can drag a box around them to select them and then move them.

    But yeah the examples aren't that much help for this because it isn't dynamic. I came up with a solution by just using an array to keep track of the x/y positions of each object I want to move. Basically when you click the mouse down, you should run a fastloop for the number of selected objects and save this to an array:

    XMouse - X position of each object being iterated (save fast loop index to X array value)
    YMouse - Y position of each object being iterated (just set Y array value to 1)

    Also on the click down event, set a flag somewhere to 1 to indicate that dragging is active.

    Then have a condition below that checks for the dragging flag to be 1, and while it is true run an opposite fastloop through those objects again but instead of saving to array, you read from it:

    - Set x position of iterated object to XMouse - X Array value at current iteration
    - Set y position of iterated object to YMouse - X Array value at current iteration and Y at 1

    Then on mouse not being held down, set the drag flag to 0 to stop the dragging. :)

    All you are doing is storing all the object x/y positions in relation to the mouse, so it knows where to place them once the mouse starts moving.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • KLiK-iT
    Here is the updated example without any extension, should work in Flash now: Please login to see this attachment.


    Additional the dragging of a single item is now restricted to the range of the Container box by

    1) Find the max. value of X(Item) and Left Edge(Box)
    2) Find the min. value of 1) and Right Edge(Box), this is the new X-Position of the object.
    The same goes for the Y-Position.

    In one line for X and Y:
    Set X to Min(Max (X(Item), Left Edge(Box)), Right Edge Box)
    Set Y to Min(Max (Y(Item), Top Edge(Box)), Bottom Edge Box)


    Konidias
    This example uses a similar solution you suggested, but stores the position values directly in the Alterable Value of the objects.
    With the Pick object with fixed value-Condition you can set/read the values and set the position of the objects each one in a single line, a Fastloop is not necessary.

  • I think I avoided the pick object method because I was using a selection rectangle method and not just putting an active object as a box behind the other objects. Meaning you could drag a selection box over multiple objects and they would then be "selected" you then click drag any one of them to move the entire group. But maybe I was doing something wrong... I might try this other method then, but really in this case a fast loop is not going to harm anything. Maybe if I was having to select and move 1000 objects.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!