How do I get my Jigsaw pieces to snap?

Get help using Construct 2

Post » Mon Oct 05, 2015 9:22 pm

Message: evonyrocksme is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I'm trying to get my Jigsaw pieces to snap but they won't. Can anyone please help? I've tried increasing the distance between the two pieces from 7px but that doesn't change a thing. I made it larger than the layout and it still won't mesh. This is part of the StemFuse Game:It Intermediate Course, for reference. Thank you.
B
2
Posts: 3
Reputation: 156

Post » Tue Oct 06, 2015 2:11 am

I've never seen or heard of that course, but you could always try using a Tiled Background or maybe an array to get it to snap to a grid. That isn't in my expertise though, so it would be best to have someone else explain ;)
I like giving game advice more than I actually like making games ;)

Image
B
40
S
16
G
3
Posts: 129
Reputation: 4,701

Post » Tue Oct 06, 2015 5:50 pm

Thanks anyways. We're doing it in my high school as a video game designing course and everyone is stuck on it. The teacher doesn't know what's going on either. The program is making it really weird though, it's deciding whether or not to snap the pieces based off of a local number, but when I follow the instructions exactly I move 5 pieces at once. Also, does anyone know where to download the canvas plugin? We have it at school but I can't work on my project at home until I install it on my computer.
B
2
Posts: 3
Reputation: 156

Post » Tue Oct 06, 2015 6:04 pm

Here's the forum thread for R0J0hound's canvas plugin.

As for your snapping problem, I fear you will have to provide more information for us to work with before we can actually help you go in the right direction.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Tue Oct 06, 2015 6:37 pm

Yeah, could you maybe provide us a link to your capx and a link to the tutorial?
I like giving game advice more than I actually like making games ;)

Image
B
40
S
16
G
3
Posts: 129
Reputation: 4,701

Post » Tue Oct 06, 2015 8:46 pm

I'm unfamiliar with that course, but the way I'd do snapping is to make your puzzle with all the pieces in place in the editor. Then add two instance variables to the pieces: "startx" and "starty". They are the locations you'd want to snap to. You don't set them in the editor, instead do it with an event:

start of layout:
--- sprite: set startx to self.x
--- sprite: set starty to self.y

Then snapping can be done by comparing the distance between the sprite and startx/y when you drop it.

sprite: dragdrop: on drop
system compare distance(sprite.x, sprite.y, sprite.start.x, sprite.starty) < 16
--- sprite: set position to (self.startx, self.starty)
B
94
S
33
G
114
Posts: 5,360
Reputation: 73,781

Post » Wed Oct 07, 2015 8:12 am

B
21
S
8
G
6
Posts: 177
Reputation: 8,134

Post » Fri Nov 13, 2015 6:36 pm

I figured it out. Thanks anyways guys! I appreciate it. One of the events were off.
B
2
Posts: 3
Reputation: 156


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests