This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

DonaldDuck
DonaldDuck presents ...

2011/1/19

Sliding Puzzle

A simple sliding puzzle with a detailed source-code showing step-by-step instructions on how to make something of the sort.

__________________________________________
**************Keystrokes***************
__________________________________________

0 - Toggle from the 4-piece puzzle to the 16-piece puzzle.
9 - Shuffle the pieces in the 16-piece puzzle. Quite a challenge.
Arrow Keys - Move pieces.

1 - Toggle the System.out.println commands (Outputting where the empty space is on the 2x2 grid) Most of you won't care for this one.

5595 views / 890 in the last 7 days

1 vote | 0 in the last 7 days

Tags: game demo with-source puzzle help sliding

open in greenfoot
Your browser is ignoring the <APPLET> tag.
mjrb4mjrb4

2011/1/19

Nice - one bug though, surely you shouldn't be able to slide along diagonals?
DonaldDuckDonaldDuck

2011/1/19

Right, I'll fix that later today. I'll probably add modes with more pieces too. Thanks.
A new version of this scenario was uploaded on Wed Jan 19 14:44:09 UTC 2011 Made diagonal movement illegal.
A new version of this scenario was uploaded on Thu Jan 20 01:48:55 UTC 2011 Diagonal movement is illegal. Now uses Pythagorean Theorum to make sure we aren't moving diagonally, much simpler. Added a puzzle with more pieces. Setting up something to shuffle the pieces for actual gameplay.
A new version of this scenario was uploaded on Thu Jan 20 04:44:47 UTC 2011 Shuffle mode added. Small bugfix. Added black-and-white background image.
A new version of this scenario was uploaded on Thu Jan 20 04:44:54 UTC 2011
A new version of this scenario was uploaded on Fri Jan 21 00:33:36 UTC 2011 Randomizing is slower, also it's enabled in the 2x2 puzzle
A new version of this scenario was uploaded on Sat Jan 22 03:35:04 UTC 2011 Arrow key movement. Be warned, it can move more than one piece at a time. I'm not really planning on a fix for this. It makes it a challenge.
A new version of this scenario was uploaded on Sat Jan 22 18:23:10 UTC 2011 Added music, made with Mixcraft. Looping isn't exactly seamless, but it'll do.

Want to leave a comment? You must first log in.

Who likes this?

Almog