ࡱ> Root EntryRoot Entryp|YrRASH?@ABCDEFGHIKLMNOPQRSTUVWXYZ\]^_abcdeghijklmnoqrsuvwxCPicPage CPicLayer CPicFrame CPicSprite char CPicShape@j 0 j @ 0 j? char @j 0 j @0 j? char @j0 j @ 0 j?Layer 1OCPicPage CPicLayer CPicFrame CPicSprite char CPicShape@j 0 j dd? char @ 0 j dd? char @j 0 j 8dd?Layer 1OCPicPage CPicLayer CPicFrame CPicShape0000 @j0 j@0 j?Layer 1OCPicPage CPicLayer CPicFrame CPicSprite char CPicShape@0 j dd? char @0 j 8dd? char @D0 j dd?Layer 1OCPicPage CPicLayer CPicFrame CPicSprite char?char?char?char?Layer 1OCPicPage CPicLayer CPicFrameNNd0d00?Layer 1OCPicPage CPicLayer CPicFrameCPicText( @text_sans?Layer 1OCPicPage CPicLayer CPicFrame CPicShapesP0P00?P000P?0P0P0?Layer 1OCPicPage CPicLayer CPicFrame?Layer 1OCPicPage CPicLayer CPicFrameP000P?Layer 1OCPicPage CPicLayer CPicFrame CPicSprite textoint( _parent.getBytesLoaded()/1000) add " KBYTES OF " add int(_parent.getBytesTotal() /1000) add " LOADED ..."4 _parent.getBytesTotal() == _parent.getBytesLoaded())_parent.gotoAndStop(2)? CPicButton \V  3 CPicTextC=G TextField1_sansCLICK HERE TO START?   ) _root.work() )_root.getTarget() controller?assetsOO? allowscalefalseshowmenufalse?? allowscalefalse allowscalefalseour map is 2-dimensional arraymyMap1[[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]#declare game object that holds infogame{tileW:30, tileH:30} walkable tile game.Tile0function () { }game.Tile0.prototype.walkabletruegame.Tile0.prototype.frame1 wall tile game.Tile1function () { }game.Tile1.prototype.walkablefalsegame.Tile1.prototype.frame2Cdeclare char object, xtile and ytile are tile where chars center ischar){xtile:2, ytile:1, speed:2, moving:false}building the world%buildMapmapattach mouse cursor)&_root.attachMovie("mouse", "mouse", 2).attach empty mc to hold all the tiles and char)&_root.attachMovie("empty", "tiles", 1)declare clip in the game object game.clip _root.tilesget map dimensions'mapWidth = map[0].length'mapHeight = map.lengthloop to place tiles on stage, var i = 0 i0 game.targetygame.path.pop() game.targetxgame.path.pop()rightgame.targetx>ob.xtileob.dirx1ob.diry0leftgame.targetxob.ytileob.dirx0ob.diry1downob.dirx0ob.diry-1 ob.movingfalse(move)ob.y += ob.speed*ob.diry)ob.x += ob.speed*ob.dirxupdate char position ob.clip._xob.x ob.clip._yob.yface the direction)(ob.clip.gotoAndStop(ob.dirx+ob.diry*2+3)&% getTargetmust click on walkable tile/game["t_"+game.ymouse+"_"+game.xmouse].walkableupdate target tile game.targetx game.xmouse game.targety game.ymouse'if moving, wait until center is reached !char.moving){x:startx, y:starty, visited:true, parentx:null, parenty:null}add node to array;path.Unchecked_Neighbours[path.Unchecked_Neighbours.length]path[path.name]loop"path.Unchecked_Neighbours.length>0get the next node'%N = path.Unchecked_Neighbours.shift()we've finished!N.x == targetx and N.y == targetydone) make_path(N) path.donetrue. N.visitedtrueright neighbour)addNode(N, N.x+1, N.y)left neighbour)addNode(N, N.x-1, N.y) up neighbour)addNode(N, N.x, N.y+1)down neighbour)addNode(N, N.x, N.y-1)remove path object$pathcheck if path was found path.donewe reached the goal(truewe couldn't get there;(false&%workfind on which tile mouse is game.xmouse3Math.round((_root._xmouse-game.tileW/2)/game.tileW) game.ymouse3Math.round((_root._ymouse-game.tileH/2)/game.tileH)place mouse mc_root.mouse._xgame.xmouse*game.tileW_root.mouse._ygame.ymouse*game.tileH' ob = char move char !ob.movingstop walk animation)ob.clip.char.gotoAndStop(1)) moveChar(ob)walk animation)ob.clip.char.play()& make the map)buildMap(_root["myMap1"]) --script--O  CDocumentPage Page 1Scene 1@u;=>x@ Symbol 17mouseb @ mousex @ Symbol 3empty;empty; Symbol 1tileFu;tileb @ Symbol 4loaderX)8>C? Symbol 5startbutC?O? Symbol 11char f%?charh @ Symbol 12char_up C? Y? Symbol 13 char_grph %?#Y? Symbol 14 char_leftC?"UY? Symbol 15 char_downC?$YY?hhhh PublishRNWKProperties::speed256K0!PublishGifProperties::PaletteName"PublishHtmlProperties::StartPaused0%PublishFormatProperties::htmlFileName tut04.html PublishQTProperties::LayerOption PublishQTProperties::AlphaOption"PublishQTProperties::MatchMovieDim1PublishHtmlProperties::Loop1Vector::External Font Files0Vector::Generator EncodingVector::Debugging Permitted0PublishFormatProperties::jpeg0&PublishRNWKProperties::speedSingleISDN0&PublishRNWKProperties::singleRateAudio0PublishQTProperties::Width240$PublishPNGProperties::OptimizeColors1PublishHtmlProperties::Units0Vector::Generator Command%PublishRNWKProperties::mediaCopyright 2000#PublishRNWKProperties::flashBitRate1200PublishGifProperties::Smooth1&PublishFormatProperties::flashFileName tut04.swf%PublishFormatProperties::projectorMac0!PublishRNWKProperties::exportSMIL1 PublishRNWKProperties::speed384K0"PublishRNWKProperties::exportAudio1"PublishGifProperties::DitherOptionPublishHtmlProperties::Quality4(PublishHtmlProperties::VerticalAlignment1Vector::Generator Height180$PublishFormatProperties::pngFileName tut04.pngPublishFormatProperties::html1'PublishRNWKProperties::mediaDescription"PublishPNGProperties::FilterOption!PublishHtmlProperties::DeviceFont0Vector::Generator ColorVector::Override Sounds0PublishQTProperties::Flatten1PublishJpegProperties::DPI4718592PublishPNGProperties::BitDepth24-bit with AlphaPublishPNGProperties::Smooth1"PublishGifProperties::DitherSolids0PublishGifProperties::Interlace0"PublishHtmlProperties::DisplayMenu0*PublishHtmlProperties::HorizontalAlignment1Vector::Quality80Vector::Protect0*PublishFormatProperties::generatorFileName tut04.swtPublishFormatProperties::gif0Vector::Template$PublishRNWKProperties::mediaKeywords!PublishRNWKProperties::mediaTitlePublishRNWKProperties::speed28K1PublishGifProperties::Loop1PublishGifProperties::Width240#PublishFormatProperties::qtFileName tut04.mov$PublishRNWKProperties::speedDualISDN0$PublishRNWKProperties::realVideoRate100000PublishJpegProperties::Quality80"PublishPNGProperties::DitherOption#PublishGifProperties::PaletteOption#PublishGifProperties::MatchMovieDim1Vector::Generator LoadOrderVector::Generator Width240PublishFormatProperties::flash1$PublishJpegProperties::MatchMovieDim1#PublishPNGProperties::PaletteOption#PublishPNGProperties::MatchMovieDim1PublishHtmlProperties::Align0-PublishFormatProperties::projectorWinFileName tut04.exe#PublishQTProperties::PlayEveryFrame0"PublishJpegProperties::Progressive0"PublishPNGProperties::DitherSolids0PublishHtmlProperties::Height180PublishHtmlProperties::Width240Vector::Debugging PasswordVector::Omit Trace Actions0%PublishFormatProperties::jpegFileName tut04.jpgPublishJpegProperties::Size0PublishPNGProperties::Interlace0PublishGifProperties::Height180'PublishHtmlProperties::TemplateFileName/C:\PROGRA~1\MACROM~1\FLASH5~1\Html\Default.html!PublishHtmlProperties::WindowMode0Vector::TopDown0-PublishFormatProperties::projectorMacFileName tut04.hqxPublishFormatProperties::rnwk0PublishFormatProperties::png0PublishRNWKProperties::speed56K1PublishQTProperties::Height180%PublishPNGProperties::RemoveGradients0PublishGifProperties::MaxColors255'PublishGifProperties::TransparentOptionPublishGifProperties::LoopCountVector::Report0"PublishFormatProperties::generator"PublishRNWKProperties::audioFormat0$PublishGifProperties::OptimizeColors1Vector::Version5Vector::Event Format0Vector::Stream Compress7PublishFormatProperties::qt0 PublishRNWKProperties::speed512K0PublishJpegProperties::Height180PublishPNGProperties::Height180PublishPNGProperties::Width240%PublishGifProperties::RemoveGradients0PublishHtmlProperties::Scale0Vector::Event Compress7"PublishRNWKProperties::mediaAuthor(PublishRNWKProperties::speedCorporateLAN0&PublishRNWKProperties::showBitrateDlog1"PublishRNWKProperties::exportFlash1PublishQTProperties::Looping0*PublishQTProperties::UseQTSoundCompression0PublishJpegProperties::Width240!PublishPNGProperties::PaletteName!PublishPNGProperties::Transparent0&PublishGifProperties::TransparentAlpha128PublishGifProperties::Animated0Vector::Stream Format0$PublishFormatProperties::gifFileName tut04.gifPropSheet::ActiveTab1621"PublishQTProperties::PausedAtStart0%PublishQTProperties::ControllerOption0PublishPNGProperties::MaxColors255Vector::MatchMovieDim1Vector::Generator FPS12%PublishFormatProperties::rnwkFileName tut04.smil%PublishFormatProperties::projectorWin0%PublishFormatProperties::defaultNames1 CColorDef   3P fP0 PH P` Px 3 33( 3f<0 3CH 3F` 3Hx f0 f30 ff(0 f5H f<` f@x  3330  3 33x f3d0 3]H 3Z` 3Xx 33 3330 3f3PPH 33Px` 33Px 33P f30 f33PH ff3(PH f3<x` f3Cx f3F  fff`  f0 3f0 ffx0 fkH fd` f`x 3f0 33fPH 3ffxPH 3fdx` 3f]x 3fZ ff0 f3fPH fff` ffP0x ffPx ffP    H 3H fH xH ̙n` hx 3H 33x` 3fx` 3xx` 3̙kx 3d fH f3x` ff0x fx0x f̙dx f]    ` 3` f` ` x` px 3` 33x 3fx 3x 3xx 3n f` f3x ffx fx fxx fk    x 3x fx x x xx 3x 33 3f 3 3 3x fx f3 ff f f fx  x  H 3 H fH (H 2` 8x ` 3 ` f` ̙` (` 0x x 3x fx x  x (x  Px  3H 33x` f3x` 3(x` 35x 3< 3` 33x f3 x ̙3x 3(x 32 3x 33 f3 3 3 3(  x  fH 3fx` ff0x f(0x f<x fC f` 3fx ffx ̙fx f(x f5 fx 3f ff f f f(  (x  H 3x` f0x  ̙PP P ` 3x fx ̙P ̙(P < x 3 f  ̙ (  xx  ` 3x fx P xP d ` 3x fx ̙P  P x 3 f   (  x  x 3 f   x x 3 f ̙  x x 3 f          f`zf *](o"PublishQTProperties::QTSndSettingsCQTAudioSettings