DragDrop Snap to Grid ?

0 favourites
  • 6 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • I'm trying to figure out how to use the drag and drop behavior to snap to grid when it is Colliding with another object. And I need it to snap RELATIVE to that object position.

    Kind of like this:

    construct.net/en

    But I want it to snap relative to the object it is colliding with.

    Thanks

  • basically this is what your lookin for

    <img src="https://dl.dropbox.com/u/53012532/SnapToDroppedOverlap.png" border="0" />

    It sets the dropped objects x outside of the overlapped object but doesnt effect its y. No matter where you drop Sprite2 on Sprite itll never overlap

    The main problem is its not easy (I cant figure it out) to take into account y instead of x. Like to place it above or below but on the same x. You cant do both cause itll always be angled to the edge regardless of actual dropped location.

    It could be done but basically itd just add quite a few more events

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks man! got it workin the way i needed

  • Thanks man! got it workin the way i needed

    How did you get it working? Care to share?

  • oprogfrogo. I was surprised how easy this is.

       -> Sprite: set X to round(mouse.X/cellsize)*cellsize

       -> Sprite: set Y to round(mouse.Y/cellsize)*cellsize

    More examples: construct.net/en

  • oprogfrogo. I was surprised how easy this is.

       -> Sprite: set X to round(mouse.X/cellsize)*cellsize

       -> Sprite: set Y to round(mouse.Y/cellsize)*cellsize

    More examples: construct.net/en

    You absolute champion!

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