'Snap to grid' Panel objects help?

For questions about using Classic.

Post » Fri Feb 03, 2012 7:34 pm

Drag and drop Panels.

Can somebody please help me with the following ?

I want to be able to drop the grey(drag and drop) PANELS into the blue larger square(sprite)

If a grey PANEL overlaps one thats already in-place, or it isnt inside the blue square, I need it to 'snap' into the nearest correct position when its 'dropped'

NOTE: The panel doesn't have an 'overlap at offset' condition like a normal sprite object.



Thanks in advance.

B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Fri Feb 03, 2012 9:16 pm

How's this:
http://dl.dropbox.com/u/5426011/examples%209/grid_fit.cap

If the piece can't be placed the piece is moved one position to each side then the corners. Checking stops when a valid position is found.

It only looks 1 space away from where you drop it. Here is an extension of the example to fit the piece somewhere on the image if an immediate nearby spot is not available.
http://dl.dropbox.com/u/5426011/examples%209/grid_fit2.cap
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Fri Feb 03, 2012 10:01 pm



Many thanks.
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Fri Feb 03, 2012 10:25 pm

Your examples contain 9 pieces/ panels.

Is there a formula I can apply to your examples, if I want to have...say 20 or even 30 blocks?
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Fri Feb 03, 2012 10:36 pm

The number of pieces was arbitrary. You can use as many or as few as you need, just add more instances.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests