How do I get my Jigsaw pieces to snap?

0 favourites
  • 8 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • 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.

  • 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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Yeah, could you maybe provide us a link to your capx and a link to the tutorial?

  • 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)

  • I figured it out. Thanks anyways guys! I appreciate it. One of the events were off.

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