ࡱ> Root EntryRoot Entryp|YrRASH66AuContents%&Page 1+Symbol 17 9E  !"#$&'()*+,-./012345678Symbol 35Symbol 1*Symbol 4$QSymbol 5  Symbol 11 Symbol 13NSymbol 18#  !"#%&'()+,-./01234678:;<=>CPicPage CPicLayer CPicFrameA `000A0 P˜0p0 p0 ?Layer 1OCPicPage CPicLayer CPicFrame 3f3f0@,0@0@@?Layer 1OCPicPage CPicLayer CPicFrame CPicSprite char? char? char CPicShape.s0@? char )s0@?Layer 1OCPicPage CPicLayer CPicFrameN0d0d0?Layer 1OCPicPage CPicLayer CPicFrameCPicText( @text_sans?Layer 1OCPicPage CPicLayer CPicFrame CPicShapesX0PX0P0? fff0pTVpP0XpP0PX??Layer 1OCPicPage CPicLayer CPicFrame?Layer 1OCPicPage CPicLayer CPicFrame CPicShape,p0X0PX0P?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)? CPicButton4h4 3 CPicTextCEG TextField1_sansCLICK HERE TO START?   ) _root.work() 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, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]#declare game object that holds infogameB{tileW:30, visx:7, visy:7, centerx:180, centery:105, 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 ischarX{xtile:1, ytile:1, speed:3, width:16, height:16, xstep:game.tileW/4, ystep:game.tileW/4}building the world%buildMapmap.attach empty mc to hold all the tiles and char)&_root.attachMovie("empty", "tiles", 1)(attach empty mc to hold background tiles)+_root.tiles.attachMovie("empty", "back", 0)%find number of half the visible tiles game.halfvisxint(game.visx/2) game.halfvisyint(game.visy/2)' ob = charcalculate starting positionob.x ob.xtile*game.tileW+game.tileW/4ob.y ob.ytile*game.tileW+game.tileW/4$calculate position in isometric viewob.xiso ob.x-ob.yob.yiso (ob.x+ob.y)/2declare clip in the game object game.clip _root.tiles game.clip._xgame.centerx-ob.xiso game.clip._ygame.centery-ob.yisoloop to place tiles on stage, var y = char.ytile-game.halfvisyy<=char.ytile+game.halfvisy+1++y, var x = char.xtile-game.halfvisxx<=char.xtile+game.halfvisx+1++xname of new tile'name = "t_"+y+"_"+x check if tile is on the map area8y>=0 and x>=0 and y<=map.length-1 and x<=map[0].length-1 make new tile object in the game game[name]new game["Tile"+map[y][x]]()make new empty tile object game[name]new game.Tile4()game[name].walkable'clip = game.clip.back'clip = game.clipcalculate depthgame[name].depth)(y+x)*game.tileW/2*300+(x-y)*game.tileW+1attach tile mc and place it)0clip.attachMovie("tile", name, game[name].depth) clip[name]._x(x-y)*game.tileW clip[name]._y(y+x)*game.tileW/2send tile mc to correct frame)(clip[name].gotoAndStop(game[name].frame)--add the frame above everything)(_root.attachMovie("frame", "frame", 100)calculate depth ob.depthshift(game.tileW-ob.height)/2ob.depth%(ob.yiso-ob.depthshift)*300+ob.xiso+1add the character mc)/game.clip.attachMovie("char", "char", ob.depth)declare clip in the game objectob.clipgame.clip.char place char mc ob.clip._xob.xiso ob.clip._yob.yiso)ob.clip.gotoAndStop(ob.frame)&% changeTilexold, yold, xnew, ynew, mapname of new tile'nameold = "t_"+yold+"_"+xold'namenew = "t_"+ynew+"_"+xnewgame[nameold].walkable'clipold = game.clip.back'clipold = game.clip check if tile is on the map areaDynew>=0 and xnew>=0 and ynew<=map.length-1 and xnew<=map[0].length-1 make new tile object in the game game[namenew]"new game["Tile"+map[ynew][xnew]]()make new empty tile object game[namenew]new game.Tile4()game[namenew].walkable'clipnew = game.clip.back'clipnew = game.clipcalculate depthgame[namenew].depth5(ynew+xnew)*game.tileW/2*300+(xnew-ynew)*game.tileW+1/check if tile should be changed to another clipclipold != clipnewdelete old movie clip)"clipold[nameold].removeMovieClip())9clipnew.attachMovie("tile", namenew, game[namenew].depth) rename mcclipnew[nameold]._namenamenew change depth)0clipnew[namenew].swapDepths(game[namenew].depth)clipnew[namenew]._x(xnew-ynew)*game.tileWclipnew[namenew]._y(ynew+xnew)*game.tileW/2send tile mc to correct frame)1clipnew[namenew].gotoAndStop(game[namenew].frame)&% getMyCornersx, y, obfind corner pointsob.downY&Math.floor((y+ob.height-1)/game.tileW)ob.upYMath.floor((y)/game.tileW)ob.leftXMath.floor((x)/game.tileW) ob.rightX%Math.floor((x+ob.width-1)/game.tileW)check if they are walls ob.upleft'game["t_"+ob.upY+"_"+ob.leftX].walkable ob.downleft)game["t_"+ob.downY+"_"+ob.leftX].walkable ob.upright(game["t_"+ob.upY+"_"+ob.rightX].walkable ob.downright*game["t_"+ob.downY+"_"+ob.rightX].walkable&%moveCharob, dirx, diryvertical movementwhere are our edges?)first we look for y movement, so x is old)*getMyCorners(ob.x, ob.y+ob.speed*diry, ob),move got dammit... and check for collisions.going up diry == -1ob.upleft and ob.uprightno wall in the way, move on)ob.y += ob.speed*diry&hit the wall, place char near the wallob.yob.ytile*game.tileW if going down diry == 1ob.downleft and ob.downright)ob.y += ob.speed*diryob.y!(ob.ytile+1)*game.tileW-ob.heighthorisontal movement&changing x with speed and taking old y)*getMyCorners(ob.x+ob.speed*dirx, ob.y, ob) if going left dirx == -1ob.downleft and ob.upleft)ob.x += ob.speed*dirxob.xob.xtile*game.tileWif going right dirx == 1ob.upright and ob.downright)ob.x += ob.speed*dirxob.x (ob.xtile+1)*game.tileW-ob.width$calculate position in isometric viewob.xiso ob.x-ob.yob.yiso (ob.x+ob.y)/2update char position ob.clip._xob.xiso ob.clip._yob.yisoface the direction)"ob.clip.gotoAndStop(dirx+diry*2+3)(calculate the tile where chars center isob.xtileMath.round(ob.x/game.tileW)ob.ytileMath.round(ob.y/game.tileW) _root.xtileob.xtile _root.ytileob.ytilecalculate depthob.depth'(ob.yiso-ob.depthshift)*300+(ob.xiso)+1)ob.clip.swapDepths(ob.depth)scroll the background game.clip._xgame.centerx-ob.xiso game.clip._ygame.centery-ob.yisoob.x''xtile = Math.floor(ob.xstep/game.tileW)'xold = xtile+game.halfvisx+1'xnew = xtile-game.halfvisx-1, var i = ob.ytile-game.halfvisy-1i<=ob.ytile+game.halfvisy+1++i)ob.y''ytile = Math.floor(ob.ystep/game.tileH)'yold = ytile+game.halfvisy+1'ynew = ytile-game.halfvisy-1, var i = ob.xtile-game.halfvisx-1i<=ob.xtile+game.halfvisx+1++i)C? Symbol 5startbutC?O? Symbol 11char f%?charN@ Symbol 13 char_grph %?#N@ Symbol 18framed@?frame]@ hhhhh%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