How do I pin to same sprite at offset?

0 favourites
  • 5 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hi all,

    I'm building a level designer like Mario Maker. The user can spawn multiple sprites with a button.

    Create object "SpriteX" on layer etc.

    SpriteX has behavior Drag&Drop & Pin. When the user drags a SpriteX at offset X 10 to another SpriteX they should stick to each other like Lego parts stick to each other. I want to let them unstuck with double tap later.

    I tried a lot of things before opening this topic and did 4 hours of searching yet failed to make this happen.

    Any help is welcome.

    Thanks for reading.

  • I gave this a quick shot and failed as well. What I can say is that using invisible helper sprites as pinning assistants didn't work out in the end, and if I were to attempt again I would definitely utilize families, probably not rely on the built in behaviors, and use an instance variable to keep track of groups of pinned objects.

    The good news is that the pin and drag drop behavior are both probably among the easiest ones to recreate by events.

    Scene graph hierarchies may also possibly be of use here to keep track of groups, but I unfortunately have zero experience with those yet so I'm not sure.

  • I gave this a quick shot and failed as well. What I can say is that using invisible helper sprites as pinning assistants didn't work out in the end, and if I were to attempt again I would definitely utilize families, probably not rely on the built in behaviors, and use an instance variable to keep track of groups of pinned objects.

    The good news is that the pin and drag drop behavior are both probably among the easiest ones to recreate by events.

    Scene graph hierarchies may also possibly be of use here to keep track of groups, but I unfortunately have zero experience with those yet so I'm not sure.

    Thanks for trying,

    You seem to be right after trying for hours I'm almost about to conclude that pin behavior isn't able to do this and drag&drop is very plain. Going to try to do it with heavy logic if there is no simple solution from no one.

    That heavy logic would be:

    If SpriteX offsetX < 30.

    -> SpriteX(1).X = SpriteX(1).X - 30 (bring them closer)

    -> Save in some storage(json)

    -> -> SpriteX(0) parent of SpriteX(1)

    On dragging

    -> If has child move child to parent position.

    Praying for easier solution from someone before i start my conquest of try&error. :D

    Again thanks for trying!

  • Pinning same sprite one after anothe with distance? Yes you are able to do that but with lag compensation such as my example:

    https://www.dropbox.com/s/dweiseyefic0m3g/pin_to_pin.capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pinning same sprite one after anothe with distance? Yes you are able to do that but with lag compensation such as my example:

    https://www.dropbox.com/s/dweiseyefic0m3g/pin_to_pin.capx?dl=0

    Thanks this example is very enlightening <3

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