How Do I: SnapGrid and Drop

Get help using Construct 2

Post » Wed Dec 03, 2014 11:38 am

I been watching tutorials, and not found exactly what I want, though one is you looked.

What I want is that snaps into the square piece if something sticks out of the piece is not placed. and being close is automatically place.

https://www.dropbox.com/s/fkmbxp5c6moifpw/snap.capx
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Wed Dec 03, 2014 1:26 pm

Nothing? Image
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Wed Dec 03, 2014 3:12 pm

@Magistross posted an example of exactly what you need, I think. The magic of tilemaps, have a look at this post
B
11
S
6
G
2
Posts: 77
Reputation: 1,504

Post » Wed Dec 03, 2014 3:52 pm

Thanks is perfect :D I was searching and searching with no luck, thanks for finding it
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Wed Dec 03, 2014 7:39 pm

@Magistross
If I want to put this so big grid, as I can do? only 32x32? I'm a little lost http://i61.tinypic.com/2ilc582.gif
Let's see if someone can help me too :P
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Thu Dec 04, 2014 10:52 am

Please helppp :(
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Thu Dec 04, 2014 2:43 pm

I'm guessing you'd have to change this in the even sheet:

>Draggable| On DragDrop drop
-->System | canFit = 1
----> Draggable | Set position to DropZone.SnapX(Self.X + 16) - 16, DropZone.SnapY(Self.Y + 16) - 16

To half the size you want as it is using the origin of the tile +half the width of your tiles


And then for both Tilemaps (DropZone and Draggable), setting the Tilemap width and height properties to the tile size you are using (set to 32x32 right now)
B
11
S
6
G
2
Posts: 77
Reputation: 1,504

Post » Thu Dec 04, 2014 5:30 pm

@Kouji San is right. You first have to set your tilemaps to the width/height of your choice, and then adjust events accordingly. Here's the modified example with a tile size of 64x64. I also added global constants for a quicker way of changing tile size.
You do not have the required permissions to view the files attached to this post.
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Thu Dec 04, 2014 6:49 pm

First of all thanks :D but one thing I do not understand, as you shape? click Draggable and is 6 squares of different colors, as changing the shape of the square?
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Thu Dec 04, 2014 6:59 pm

The 6 squares are the tiles. Pieces are simply tilemaps (Draggable) with any of the tiles drawn on it. The DropZone is a tilemap with transparent square (the only tile). You have to use the Tilemap toolbar to edit any of the objects.
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 35 guests