Ive been working on the coding, and Ive done quite a bit so far. Shall I show off my work? Um, yeah, why not :P
game = {randomMap:Number, height:Number, width:Number, clip:Movieclip, tileWidth:Number, tileHeight:Number, tilelist:new Array};
game.width = 550;
game.height = 400;
game.clip = attachMovie("empty", "gameclip", 1);
tile = {width:Number, height:Number, frames:Number};
tile.width = 25;
tile.height = 25;
tile.clip = game.clip.attachMovie("tiles", "tileclip", 1);
tile.frames = tile.clip._totalFrames;//only 3 tiles
game.tileWidth = game.width/tile.width;
game.tileHeight = game.height/tile.height;
var i:Number;
var j:Number;
//defining random values
var temprandomone:Number
var temprandomtwo:Number
var temprandomthree:Number
var temprandomfour:Number
var temprandomfive:Number
var temprandomsix:Number
temprandomone = Math.round(2+(Math.random*(game.tileWidt h-2)));
temprandomtwo = Math.round(2+(Math.random*(game.tileWidt h-2)));
if (temprandomtwo == temprandomone) {
if (temprandomtwo > (game.tileWidth/2)) {
temprandomtwo -= 2;
} else {
temprandomtwo += 2;
}
}
temprandomthree = Math.round(2+(Math.random*(game.tileWidt h-2)));
if (temprandomthree == temprandomtwo || temprandomthree == temprandomone) {
if (temprandomthree > (game.tileWidth/2)) {
temprandomthree -= 4;
} else {
temprandomthree += 4;
}
}
temprandomfour = Math.round(2+(Math.random*(game.tileHeig ht-2)));
temprandomfive = Math.round(2+(Math.random*(game.tileHeig ht-2)));
if (temprandomfive == temprandomfour) {
if (temprandomfive > (game.tileHeight/2)) {
temprandomfive -= 2;
} else {
temprandomfive += 2;
}
}
temprandomsix = Math.round(2+(Math.random*(game.tileHeig ht-2)));
if (temprandomsix == temprandomfive || temprandomsix == temprandomfour) {
if (temprandomsix > (game.tileHeight/2)) {
temprandomsix -= 4;
} else {
temprandomsix += 4;
}
}
//random map making 1=solid 2=floor
for (i=1, i>(game.width/tile.width), i++) {
for (j=1, j>(game.height/tile.height), j++) {
tilelist[i][j] = 1;
}
tilelist [i][temprandomone] = 2;
tilelist [i][temprandomtwo] = 2;
tilelist [i][temprandomthree] = 2;
}
for (j=1, j>(game.height/tile.height), j++) {
tilelist [temprandomfour][j] = 2;
tilelist [temprandomfive][j] = 2;
tilelist [temprandomsix][j] = 2
}
//mapbuilding
for (i=1, i>game.tileWidth, i++) {
for (j=1, j>game.tileHeight, j++) {
var tempname:String = "t"+i+"_"+j;
game.clip.duplicateMovieClip(tile.clip, tempname, (i*100)+j);
game.clip[tempname] = (i*tile.width)-(tile.width/2);
game.clip[tempname] = (j*tile.height)-(tile.height/2);
game.clip[tempname].gotoAndStop(game.til elist[i][j]);
}
}
A lot of the start code I wrote on the spot, but the mapbuilding code is a modded version of my main project's mapbuilding code. I probably got something wrong, but hey, at least Im doing something :P