View Full Version : Another Game - Tiled Picture Puzzle

07-20-2002, 01:37 PM
Sample Page (http://fitale.resource-locator.com/volatile/footer.htm)

A puzzle game that takes a set of images (that make up a pic)
and randomizes them. Click one and then another to swap their
places - upon completion an event is fired (user codable). Uses
the document.images[] collective though I'm pretty sure it does
not work in old NS browsers.

view-source:http://fitale.resource-locator.com/volatile/tiles.js == The external js file
//edit - forum wouldn't accept a [url = view-source: link] syntax

Sample Page

<style type="text/css">
body{margin:0px; background-color:ButtonFace;}

<script language="javascript">
scripted in Notepad by md@fitale.com

image names should have syntax prefix_columnxrow.format
eg tile_3x4.jpg would be the fourth tile in the third row from the top


folda = "puzzleimage"; // images folder
picfix = "tile_"; // prefix name of tiles
format = ".jpg"; // file type
coloms = 8; // numbers of columns
rowz = 6; // number of rows
wid = 60; // width of tiles
hei = 60; // height of tiles
diffi = 2; // difficulty - max number of correct tiles at start - 1-4 is good
function getset() {top.strt();} // start event - possibly a timer function
function dunit() {top.stp=0;} // completion event - eg stop timer

adim = new Array()
for (x=0;x<[rowz+1];x++) {
for (y=0;y<[coloms+1];y++) {
adim[z] = new Image();
adim[z].src = folda+"/"+picfix+[x]+"x"+[y]+format;

// -->

<script language="javascript" src="tiles.js"></script>


Because I use psp7, I mimiced the tile naming protocol from the
[file][export][imageSlicer] bit - so making puzzles should be no
prob for peeps with that software.

Anyway - feel free to play around with the coding - change the
start/stop events - improve it, compress it, hey you can even
make it NS4 compat if you want.