Multiple drand and drop

0 favourites
  • 6 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • The drag and drop is a neat behaviour, I love how easy it is to use.

    I am trying to make a map editor, and right now I need to find out how I can drag and drop multiple sprites.

    The obvious was for me to add drag and drop to the sprite and backgrounds I wanted to move, but the only sprites effected are the ones directly under the mouse.

    I have all the objects with a "Selected off =0, or 1 for on", I want to move only the ones with selected = 1.

    Is there some way to tell all the selected sprites to track the mouses X and track the mouses Y movements?

    Thanks in advanced. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • dropbox.com/s/vge54fyvya5v8r4/cap.JPG

    Thats how I do it. drag and drop wasn't really doing it for me. if you spawned an item after a click you had to re-click to drag, this way grabs it and holds it until you let go

  • .

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I would do it along these lines i think:

    on left click on sprite :

        if selected

            Sprite selected = False

        else

            Sprite selected = True

            Sprite xOffset = self.X - Mouse.X

            Sprite yOffset = self.Y - Mouse.Y

    When dragging:

    for each sprite

        if selected :

            set X to Mouse.X+self.xOffset

            set Y to Mouse.Y+self.yOffset

  • Or you could pin the selected sprites to the one you're dragging: dragDropMultiple.capx

  • JWstudios, cvp, ramones,

    Thank you all so much!

    I came looking for a solution, and come to find 3 excellent solution's!!

    You guys rock, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)