DragDrop Snap to Grid ?

Get help using Construct 2

Post » Thu Aug 09, 2012 5:50 pm

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:

http://www.scirra.com/forum/snap-to-grid_topic47676.html

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

Thanks
B
6
S
1
Posts: 31
Reputation: 1,237

Post » Fri Aug 10, 2012 5:49 pm

basically this is what your lookin for


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
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Fri Aug 10, 2012 10:25 pm

Thanks man! got it workin the way i needed
B
6
S
1
Posts: 31
Reputation: 1,237

Post » Wed Mar 27, 2013 4:01 am

[QUOTE=Skillasaurus] Thanks man! got it workin the way i needed[/QUOTE]

How did you get it working? Care to share?
B
3
Posts: 4
Reputation: 533

Post » Fri May 10, 2013 9:35 pm

@ 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: http://www.scirra.com/forum/snap-to-grid_topic47676.htmlDrathVader2013-05-10 21:37:00
B
7
S
1
Posts: 48
Reputation: 1,729


Return to How do I....?

Who is online

Users browsing this forum: Aserak2012, ManuelPerez and 21 guests