(o = this.createEmptyMovieClip( "point" , 0 )).lineStyle(7,0xffcc00) o.moveTo(4,4) o.lineTo(4.5,4); map= new String("%C2%80%C2%80%C2%80%C2%80A%02A%02%5F%7E%60%3ESFR%26%5F%7E%60%3EA%01%01%02%5Fp%7C%3E%5Fp%7C%3EAbD%02%7F%7E%60%40%03%7E%60%21%03a%04%21%03o%3C%21%7Fo%3C%40%01%0D%19%01%7Fp%7C%40%03p%7C%21%03a%04%21%03p%7C%21%7Fp%7C%40A%02A%02%5F%7E%60%3E%5F%7E%60%3EG%01%012wp%7C8wp%7C8AbD%02%60%7E%60%7E%60%7E%60%7EA%01%01%02%C2%80%C2%80%C2%80%C2%80,%01%01%01%01%40%7F%40%7F%22%03%21C%22%03%21C%22%03%21C%40%C2%80%C2%80%7F%22%11%05C%22%11%05C%40%1F%3D%7F%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%40%7F%40%7F%22%03%21C%22%03%21C%3A%7F%40O%0A%11%05I%0A%11%05I%40%1F%3D%7F%21%03%21%03%21%03%21%03%40%C2%80%C2%80%7F%01%01%01%01").split(","); for ( var i = 0, eats = 0 ; i < 28 * 31 ; i++ ) { occ = ((dec=new String("000000").substr(0,7-(dec=(unescape(map[0]).charAt(int(i/7)).charCodeAt(0)-1).toString(2)).length)+dec).charAt(i%7)==1); eat = ((dec=new String("000000").substr(0,7-(dec=(unescape(map[1]).charAt(int(i/7)).charCodeAt(0)-1).toString(2)).length)+dec).charAt(i%7)==1); new Color(o.duplicateMovieClip("t_"+i,++d,{_x:(i%28)*8,_y:int(i/28)*8,occ:occ})).setRGB(occ?0xee9933:0x0); if(eat)new Color(o.duplicateMovieClip("e_"+i,++d,{_x:(i%28)*8+2,_y:int(i/28)*8+2,_xscale:50,_yscale:50,onUnload:function(){if(!(--eats)){trace( "CONGRATULATIONS! LEVEL COMPLETE!");gameover=true;}}},eats++)).setRGB(0x00ff00); } o.duplicateMovieClip("player",++d,{ _x: 13 * 8, _y: 23 * 8 } ).onEnterFrame = function () { if ((this._x+=vx)%8==0&&(this._y+=vy)%8==0){ vx=((uc=(Key.isDown(Key.RIGHT))?1:(Key.isDown(Key.LEFT))?2:(Key.isDown(Key.DOWN))?3:(Key.isDown(Key.UP))?4:0)==1&&!_root["t_"+((this._x>>3)+1+((this._y>>3)*28))].occ)*2+(uc==2&&!_root["t_"+((this._x>>3)-1+((this._y>>3)*28))].occ)*-2; vy=(uc==3&&!_root["t_"+((this._x>>3)+(((this._y>>3)+1)*28))].occ)*2+(uc==4&&!_root["t_"+((this._x>>3)+(((this._y>>3)-1)*28))].occ)*-2; _root["e_"+((this._x>>3)+(((this._y>>3))*28))].removeMovieClip(); } this._x= ( this._x == 216 && uc == 1 ) ? 0 : ( this._x == 0 && uc == 2 ) ? 216 : this._x; } for (e=0;e<5;e++,new Color(enemy).setRGB(0xff0000)){ (enemy = o.duplicateMovieClip("enemy_"+e,++d,{ _x: 13 * 8, _y: 13 * 8 } )).onEnterFrame = function () { if ( ( this._x += this.dir.x ) % 8 == 0 && (this._y += this.dir.y) % 8 == 0 ){ this._x=(this._x==216&&this.dir.x==2)?0:(this._x==0&&this.dir.x==-2)? 216 : this._x; p = []; if ( !_root["t_"+(((this._x>>3)+1)+((this._y>>3)*28))].occ && this.dir.x !=-2 ) p.push ( { x: 2, y: 0 } ); if ( !_root["t_"+(((this._x>>3)-1)+((this._y>>3)*28))].occ && this.dir.x != 2 ) p.push ( { x:-2, y: 0 } ); if ( !_root["t_"+((this._x>>3)+(((this._y>>3)+1)*28))].occ && this.dir.y !=-2 ) p.push ( { x: 0, y: 2 } ); if ( !_root["t_"+((this._x>>3)+(((this._y>>3)-1)*28))].occ && this.dir.y != 2 ) p.push ( { x: 0, y:-2 } ); this.dir = p[ random( p.length ) ]; } if (gameover || (gameover = ((this._x-(p = _root.player)._x)*(this._x-p._x)+(this._y-p._y)*(this._y-p._y)<64))) { trace( "GAME OVER." ); delete this.onEnterFrame; delete p.onEnterFrame; } } }