ࡱ> Root EntryRoot Entryp|YrRASHx$@k@ContentsPage 1Symbol 1P Symbol 2 Symbol 3N  !"#$%&'()*+,-./012345678CPicPage CPicLayer CPicFrame 000 ?ffff 000 ?Bfff 000 ?& Layer 1OCPicPage CPicLayer CPicFrame((000?M Layer 1OCPicPage CPicLayer CPicFrame CPicShapeffls  000 ?T Layer 1OCPicPage CPicLayer CPicFrame?p://values greater than 1 are walkable checkMAP = []; MAP = [ [2,2,2,2,0,2,2,0,2,2,2,2,0,2,2], [2,2,2,2,0,2,2,0,2,2,2,2,0,2,2], [2,2,2,0,0,2,2,0,0,2,2,2,0,2,2], [2,2,0,2,0,2,0,2,2,0,2,2,0,0,0], [2,0,0,2,2,0,0,2,2,2,2,2,2,2,2], [2,2,2,2,2,2,2,2,2,2,2,0,0,2,2], [2,2,2,0,0,0,0,0,0,0,2,2,2,2,2], [2,2,0,2,2,2,0,2,2,2,2,0,0,0,2], [2,0,0,2,0,2,0,2,0,0,2,0,2,2,2], [2,2,2,2,0,2,0,2,2,2,2,2,0,2,2], [2,2,0,2,0,2,0,2,0,2,0,0,0,2,2], [2,2,2,2,0,2,0,2,2,2,0,2,2,2,2]]; char = [1,1]; _root.attachMovie("character","character",2); _root.createEmptyMovieClip("level",1); for(i in MAP){ checkMAP[i] = []; for(j in MAP[i]){ checkMAP[i][j] = 0; t = level.attachMovie("tile","x"+j+"y"+i,d++); t.gotoAndStop(MAP[i][j]+1); t._x = 20*j; t._y = 20*i; x = char[0]; y = char[1]; character._x = 20*x; character._y = 20*y; } }?]'//CONNECTABLE POINTS STUFF level.onPress = function(){ //clear checked area for(i in MAP){ for(j in MAP[i]){ checkMAP[i][j] = 0; level["x"+j+"y"+i]._alpha = 100; } } x1 = Math.floor(level._xmouse/20); y1 = Math.floor(level._ymouse/20); //if end point walkable if(MAP[y1][x1]>1){ //x,y is start position checking = [_root.x,_root.y]; surround(x1,y1); } } function surround(x,y){ check(x,y-1); check(x+1,y); check(x,y+1); check(x-1,y); } function check(x,y){ //stopping remaining processes if necesary if(!checking) return; //if we arrive to start point x,y else if(x == checking[0] && y == checking[1]){ //stop checking checking = null; //move character to end point x1,y1 here! character._x = x1*20; character._y = y1*20; _root.x = x1; _root.y = y1; return; } //if not yet checked, surround walkable position else if(!checkMAP[y][x] && MAP[y][x]>1){ //mark position as checked checkMAP[y][x] = 1; level["x"+x+"y"+y]._alpha = 50; surround(x,y); } } stop(); Layer 1O) CDocumentPagePage 1Scene 1#UK? 8UK?Symbol 1box