ࡱ> Root EntryRoot Entryp|YrRASHF~y@ContentsY&Page 1Symbol 39  !"#$%&'()*+,-./0Symbol 1/\Symbol 4)QSymbol 5$ Symbol 11hSymbol 12 ISymbol 13  !"#%&'(*+,-.012345678:;<CPicPage CPicLayer CPicFrame CPicShapep 0000@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?Layer 1OCPicPage CPicLayer CPicFrameN0d0d0?Layer 1OCPicPage CPicLayer CPicFrameCPicText( @text_sans?Layer 1OCPicPage CPicLayer CPicFrame CPicShapep00P0P?0P0P0??Layer 1OCPicPage CPicLayer CPicFrame?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.detectKeys() 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, 0, 0, 0, 1], [1, 0, 0, 0, 0, 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, currentMap:1} walkable tile game.Tile0function () { }game.Tile0.prototype.walkabletruegame.Tile0.prototype.frame1 wall tile game.Tile1function () { }game.Tile1.prototype.walkablefalsegame.Tile1.prototype.frame2non-existing tile game.Tile4function () { }game.Tile4.prototype.walkablefalsegame.Tile4.prototype.frame20Cdeclare char object, xtile and ytile are tile where chars center ischar{xtile:1, ytile:1, speed:4}building the world%buildMapmap.attach empty mc to hold all the tiles and char)&_root.attachMovie("empty", "tiles", 1)get map dimensions'mapWidth = map[0].length'mapHeight = map.lengthdeclare clip in the game object game.clip _root.tilesloop to place tiles on stage, var y = 0 y0.5ob.downleft and ob.downright) ob.y += diryob.y!(ob.ytile+1)*game.tileH-ob.heighthorisontal movement&changing x with speed and taking old y)!getMyCorners(ob.x+dirx, ob.y, ob) if going left dirx<-0.5ob.downleft and ob.upleft) ob.x += dirxob.xob.xtile*game.tileW+ob.widthif going rightdirx>0.5ob.upright and ob.downright) ob.x += dirxob.x (ob.xtile+1)*game.tileW-ob.widthupdate char position ob.clip._xob.x ob.clip._yob.y(calculate the tile where chars center isob.xtileMath.floor(ob.x/game.tileW)ob.ytileMath.floor(ob.y/game.tileH)((true)&% detectKeys'ob = _root.char'keyPressed = falseKey.isDown(Key.RIGHT))ob.clip._rotation += 5Key.isDown(Key.LEFT))ob.clip._rotation -= 5Key.isDown(Key.UP) ob.speedx2ob.speed*Math.cos((ob.clip._rotation)*Math.PI/180) ob.speedy2ob.speed*Math.sin((ob.clip._rotation)*Math.PI/180) keyPressed(_root.moveChar(ob, ob.speedx, ob.speedy)Key.isDown(Key.DOWN) ob.speedx3-ob.speed*Math.cos((ob.clip._rotation)*Math.PI/180) ob.speedy3-ob.speed*Math.sin((ob.clip._rotation)*Math.PI/180) keyPressed(_root.moveChar(ob, ob.speedx, ob.speedy)walk animation !keyPressed)ob.clip.char.gotoAndStop(1))ob.clip.char.play()& make the map)(buildMap(_root["myMap"+game.currentMap]) --script--O["myMap"+game.currentMap]) --script--  CDocumentPage Page 1Scene 1@u;_\@ Symbol 3empty;empty; Symbol 1tileFu;tile|B\@ Symbol 4loaderX)8>C? Symbol 5startbutC?O? Symbol 11char f%?char`\@ Symbol 12 char_move _\@^_\@ Symbol 13 char_grph %?#Y?hhhh%PublishFormatProperties::htmlFileName tut04.html"PublishHtmlProperties::StartPaused0!PublishGifProperties::PaletteName PublishRNWKProperties::speed256K0PublishFormatProperties::jpeg0Vector::Debugging Permitted0Vector::Generator EncodingVector::External Font Files0PublishHtmlProperties::Loop1"PublishQTProperties::MatchMovieDim1 PublishQTProperties::AlphaOption PublishQTProperties::LayerOptionVector::Generator CommandPublishHtmlProperties::Units0$PublishPNGProperties::OptimizeColors1PublishQTProperties::Width240&PublishRNWKProperties::singleRateAudio0&PublishRNWKProperties::speedSingleISDN0%PublishFormatProperties::projectorMac0&PublishFormatProperties::flashFileName tut04.swfPublishGifProperties::Smooth1#PublishRNWKProperties::flashBitRate1200%PublishRNWKProperties::mediaCopyright 2000PublishFormatProperties::html1$PublishFormatProperties::pngFileName tut04.pngVector::Generator Height180(PublishHtmlProperties::VerticalAlignment1PublishHtmlProperties::Quality4"PublishGifProperties::DitherOption"PublishRNWKProperties::exportAudio1 PublishRNWKProperties::speed384K0!PublishRNWKProperties::exportSMIL1Vector::Override Sounds0Vector::Generator Color!PublishHtmlProperties::DeviceFont0"PublishPNGProperties::FilterOption'PublishRNWKProperties::mediaDescriptionVector::TemplatePublishFormatProperties::gif0*PublishFormatProperties::generatorFileName tut04.swtVector::Protect0Vector::Quality80*PublishHtmlProperties::HorizontalAlignment1"PublishHtmlProperties::DisplayMenu0PublishGifProperties::Interlace0"PublishGifProperties::DitherSolids0PublishPNGProperties::Smooth1PublishPNGProperties::BitDepth24-bit with AlphaPublishJpegProperties::DPI4718592PublishQTProperties::Flatten1#PublishFormatProperties::qtFileName tut04.movPublishGifProperties::Width240PublishGifProperties::Loop1PublishRNWKProperties::speed28K1!PublishRNWKProperties::mediaTitle$PublishRNWKProperties::mediaKeywordsPublishFormatProperties::flash1Vector::Generator Width240Vector::Generator LoadOrder#PublishGifProperties::MatchMovieDim1#PublishGifProperties::PaletteOption"PublishPNGProperties::DitherOptionPublishJpegProperties::Quality80$PublishRNWKProperties::realVideoRate100000$PublishRNWKProperties::speedDualISDN0-PublishFormatProperties::projectorWinFileName tut04.exePublishHtmlProperties::Align0#PublishPNGProperties::MatchMovieDim1#PublishPNGProperties::PaletteOption$PublishJpegProperties::MatchMovieDim1%PublishFormatProperties::jpegFileName tut04.jpgVector::Omit Trace Actions0Vector::Debugging PasswordPublishHtmlProperties::Width240PublishHtmlProperties::Height180"PublishPNGProperties::DitherSolids0"PublishJpegProperties::Progressive0#PublishQTProperties::PlayEveryFrame0PublishFormatProperties::png0PublishFormatProperties::rnwk0-PublishFormatProperties::projectorMacFileName tut04.hqxVector::TopDown0!PublishHtmlProperties::WindowMode0'PublishHtmlProperties::TemplateFileName/C:\PROGRA~1\MACROM~1\FLASH5~1\Html\Default.htmlPublishGifProperties::Height180PublishPNGProperties::Interlace0PublishJpegProperties::Size0"PublishFormatProperties::generatorVector::Report0PublishGifProperties::LoopCount'PublishGifProperties::TransparentOptionPublishGifProperties::MaxColors255%PublishPNGProperties::RemoveGradients0PublishQTProperties::Height180PublishRNWKProperties::speed56K1PublishFormatProperties::qt0Vector::Stream Compress7Vector::Event Format0Vector::Version5$PublishGifProperties::OptimizeColors1"PublishRNWKProperties::audioFormat0Vector::Event Compress7PublishHtmlProperties::Scale0%PublishGifProperties::RemoveGradients0PublishPNGProperties::Width240PublishPNGProperties::Height180PublishJpegProperties::Height180 PublishRNWKProperties::speed512K0$PublishFormatProperties::gifFileName tut04.gifVector::Stream Format0PublishGifProperties::Animated0&PublishGifProperties::TransparentAlpha128!PublishPNGProperties::Transparent0!PublishPNGProperties::PaletteNamePublishJpegProperties::Width240*PublishQTProperties::UseQTSoundCompression0PublishQTProperties::Looping0"PublishRNWKProperties::exportFlash1&PublishRNWKProperties::showBitrateDlog1(PublishRNWKProperties::speedCorporateLAN0"PublishRNWKProperties::mediaAuthor%PublishFormatProperties::defaultNames1%PublishFormatProperties::projectorWin0%PublishFormatProperties::rnwkFileName tut04.smilVector::Generator FPS12Vector::MatchMovieDim1PublishPNGProperties::MaxColors255%PublishQTProperties::ControllerOption0"PublishQTProperties::PausedAtStart0PropSheet::ActiveTab1621 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     f`zf *](o"Publi