This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-01-13 19:07:29

player369
Scratcher
Registered: 2008-01-05
Posts: 1

Puzzle code

im making a puzzle, but i cant figure out how to make the puzzle pieces snap together

Offline

 

#2 2008-01-13 21:18:56

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Puzzle code

That's a very interesting question.  What do you mean by snap together:

   1) If the correct piece is near the right spot, it jumps to the right spot and doesn't move anymore?

     2) If two pieces are touching each other they can be moved together as a group by dragging either one?

     3) Pieces make a snapping sound when they touch each other?

Depending on what behavior you want the pieces to do, there may be a couple of ways to make it happen.  But first you need to decide exactly what you are going to try and make the project do.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-01-13 22:51:13

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Puzzle code

My son and I worked on a jigsaw puzzle project for a while, but finally gave up on it, as it seemed to require too many variables to be fun to write (arrays would have made things much easier).  Maybe someday we'll have a bright idea for a better, simpler way to implement it and try again.

Offline

 

#4 2008-01-14 02:22:33

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Puzzle code

I once made a (Scratch-like) project about jigsaw puzzle pieces which can be snapped together:

http://scratch.mit.edu/projects/Jens/10220

But Kevin's right: It only has 3 pieces and is already *so* complicated that any 'real' puzzle just wouldn't be fun to code.

However, chalkmarrow did a really cool project about snapping sprites to a grid. Check out his project here:

http://scratch.mit.edu/projects/chalkmarrow/54925

By modifying his idea you could make a real puzzle way easier!


Jens Mönig

Offline

 

Board footer