ࡱ> Root EntryRoot Entryp|YrRASHM)ContentsF(Page 1OSymbol 20 y  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEGHIJKLMNOPQRSTUVWXYZSymbol 3 Symbol 1<Symbol 4QSymbol 5 Symbol 11wSymbol 17 fSymbol 19USymbol 12 ?ISymbol 137Symbol 14 !ISymbol 15 ISymbol 21  "#$%&'()*+,-./012345689:;<=>@ABCDEFGHIJKLMNOPQRSTVWXYZ[\]^_`abcdeghijklmnopqrstuvxyz{|}~CPicPage CPicLayer CPicFrame CPicShapewR4@ŕ:u44+@Ŋ4+v4:*4R*v4::u? stop ();  f3Sހ!+Հ/+!Ԁ߀!+/+!!!++/.++!!?Layer 1Od3CPicPage CPicLayer CPicFrame CPicSprite char CPicShape@j 0 j @ 0 j? char @j 0 j @0 j? char @j0 j @ 0 j?Layer 1O CPicPage CPicLayer CPicFrame CPicSprite char CPicShape@j 0 j dd? char @ 0 j dd? char @j 0 j 8dd?Layer 1O CPicPage CPicLayer CPicFrame CPicShapep 0000@j0 j@0 j?Layer 1Oj CPicPage CPicLayer CPicFrame CPicSprite char CPicShape@0 j dd? char @0 j 8dd? char @D0 j dd?Layer 1O CPicPage CPicLayer CPicFrame CPicSprited char?dchar?dchar?dchar?Layer 1O?CPicPage CPicLayer CPicFrame CPicSprited char?dchar?dchar?dchar?Layer 1O?CPicPage CPicLayer CPicFrame CPicSprite char?char?char?char?Layer 1OCPicPage CPicLayer CPicFrameN0d0d0?Layer 1OCPicPage CPicLayer CPicFrameCPicText( @text_sans?Layer 1O?CPicPage CPicLayer CPicFrames0P0P0?P000P?0P0P0?Layer 1OtCPicPage CPicLayer CPicFrame?Layer 1OCPicPage CPicLayer CPicFrame CPicShapeDDWxff sf  sf  ?Layer 1O0P0P0?CPicPage 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? f 7_sansPOINTS: f {points_sansPOINTS:? 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, 4, 0, 0, 0, 1], [1, 0, 0, 5, 0, 1, 0, 1], [1, 0, 0, 5, 0, 0, 0, 2], [1, 1, 1, 1, 1, 1, 1, 1]]myMap2[[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [3, 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, bulletcounter:0, points:0} game.bullets new Array() walkable tile game.Tile0function () { }game.Tile0.prototype.walkabletruegame.Tile0.prototype.frame1 wall tile game.Tile1function () { }game.Tile1.prototype.walkablefalsegame.Tile1.prototype.frame2door object prototype game.Doorspfunction (newmap, newcharx, newchary) { this.newmap = newmap;this.newcharx = newcharx;this.newchary = newchary;}game.Doors.prototype.walkabletruegame.Doors.prototype.frame3game.Doors.prototype.doortrue door tilesKmake those tiles from the door object passing newmap, newcharx and newchary game.Tile2function () { }game.Tile2.prototypenew game.Doors(2, 1, 4) game.Tile3function () { }game.Tile3.prototypenew game.Doors(1, 6, 4)'ladder tile, can be climbed up and down game.Tile4function () { }game.Tile4.prototype.walkablefalsegame.Tile4.prototype.frame2game.Tile4.prototype.laddertruegame.Tile4.prototype.itemladder'ladder tile, can be climbed up and down game.Tile5function () { }game.Tile5.prototype.walkabletruegame.Tile5.prototype.frame1game.Tile5.prototype.laddertruegame.Tile5.prototype.itemladder declare items0items array is in the order [type, xtile, ytile]myItemsK[[0], [[1, 1, 1], [1, 1, 2], [2, 1, 3]], [[2, 1, 3], [2, 6, 3], [1, 5, 4]]]declare item types game.Item1function () { }game.Item1.prototype.points1 game.Item2function () { }game.Item2.prototype.points10declare enemies8enemies array is in the order [enemy type, xtile, ytile] myEnemies[[0], [[0]], [[2, 3, 2]]]declare enemie types game.Enemyp1function () { }game.Enemyp1.prototype.xMove0game.Enemyp1.prototype.yMove1game.Enemyp1.prototype.speed2 game.Enemyp2function () { }game.Enemyp2.prototype.xMove1game.Enemyp2.prototype.yMove0game.Enemyp2.prototype.speed2declare bullet game.Bulletfunction () { }game.Bullet.prototype.speed5game.Bullet.prototype.dirx0game.Bullet.prototype.diry-1game.Bullet.prototype.width2game.Bullet.prototype.height2Cdeclare char object, xtile and ytile are tile where chars center ischar_{xtile:2, ytile:1, speed:4, jumpstart:-18, gravity:2, jump:false, climb:false, shootspeed:1000}building the world%buildMapmap.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 i0ob.dirxdirxare we jumping?Math.abs(jump) == 1speedob.jumpspeed*jumpspeedob.speedvertical movementwhere are our edges?)first we look for y movement, so x is old)'getMyCorners(ob.x, ob.y+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 += speed*diry&hit the wall, place char near the wallob.yob.ytile*game.tileH+ob.height2are we jumping around and have hit the tile above? ob.jumpspeed0 if going down diry == 1ob.downleft and ob.downright)ob.y += speed*diryob.y!(ob.ytile+1)*game.tileH-ob.heightob.jumpfalsehorisontal movement&changing x with speed and taking old y)'getMyCorners(ob.x+speed*dirx, ob.y, ob) if going left dirx == -1ob.downleft and ob.upleftset climbing flag to falseob.climbtrue)ob.x += speed*dirxcheck for tile below)fall(ob)ob.xob.xtile*game.tileW+ob.widthif going right dirx == 1ob.upright and ob.downrightset climbing flag to falseob.climbtrue)ob.x += speed*dirxcheck for tile below)fall(ob)ob.x (ob.xtile+1)*game.tileW-ob.widthupdate char position)updateChar(ob, dirx, diry)((true)&% updateCharob, dirx, diryupdate char position ob.clip._xob.x ob.clip._yob.yface the direction)"ob.clip.gotoAndStop(dirx+diry*2+3)(calculate the tile where chars center isob.xtile!Math.floor(ob.clip._x/game.tileW)ob.ytile!Math.floor(ob.clip._y/game.tileH)check for door:game["t_"+ob.ytile+"_"+ob.xtile].door and ob == _root.char make new map) changeMap(ob)check for item on current tile'-itemname = game["item"+ob.ytile+"_"+ob.xtile]itemname and ob == _root.char add points game.pointsgame.points+itemname.points _root.points game.pointsremove item movie clip itemname.clipremove item from items arraygame.items[itemname.position]0remove item object$"game["item"+ob.ytile+"_"+ob.xtile]&%jumpobgravity control ob.jumpspeedob.jumpspeed+ob.gravityob.jumpspeed>game.tileH ob.jumpspeed game.tileHob.jumpspeed<0going up)moveChar(ob, 0, -1, -1)ob.jumpspeed>0 going down)moveChar(ob, 0, 1, 1)&9check if we have walked off the tile and should fall down%fallobob.climbfalsenot while jumping!ob.jump)getMyCorners(ob.x, ob.y+1, ob)both tile below are emptyob.downleft and ob.downright falling down ob.jumpspeed0ob.jumptrue&check if we can climb up% checkUpLadderobfind up and down center points'1downY = Math.floor((ob.y+ob.height-1)/game.tileH)'-upY = Math.floor((ob.y-ob.height)/game.tileH)check if one of them is ladder'-upLadder = game["t_"+upY+"_"+ob.xtile].ladder'1downLadder = game["t_"+downY+"_"+ob.xtile].ladderupLadder or downLadder((true))fall(ob)&check if we can climb down%checkDownLadderob#find down center point after moving'8downY = Math.floor((ob.speed+ob.y+ob.height)/game.tileH)check if it is ladder'1downLadder = game["t_"+downY+"_"+ob.xtile].ladder downLadder((true))fall(ob)&climb up or down%climbob, diryset climbing flag to trueob.climbtrueob.jumpfalsemove it)ob.y += ob.speed*diry9center char to the ladder and thats in the center of tileob.x"(ob.xtile*game.tileW)+game.tileW/2update char position)updateChar(ob, 0, diry)((true)&% enemyBrain+loop through all enemies currently on stage, var i = 0i100game.bulletcounter0name of new bullet'"name = "bullet"+game.bulletcounter"make new bullet object in the game game[name]new game.Bullet()add id to bullet game[name].idgame.bulletcounteradd bullet to bullets Array)game.bullets.push(game[name]).make sure bullet is heading where player faces)take values from player if char has movedob.dirx or ob.dirygame[name].dirxob.dirxgame[name].diryob.diryadd starting tilegame[name].xtileob.xtilegame[name].ytileob.ytileadd bullet to the stage)?game.clip.attachMovie("bullet", name, 10100+game.bulletcounter)!declare clip in the bullet objectgame[name].clipgame.clip[name]calculate position game[name].x(ob.x+game[name].dirx*ob.width) game[name].y (ob.y+game[name].diry*ob.height) place clipgame.clip[name]._x game[name].xgame.clip[name]._y game[name].y&% moveBullets+loop through all bullets currently on stage, var i = 0igetMyCorners(ob.x+ob.speed*ob.dirx, ob.y+ob.speed*ob.diry, ob)9ob.downleft and ob.upleft and ob.downright and ob.uprightmove it)moveChar(ob, ob.dirx, ob.diry)delete bullet mc)ob.clip.removeMovieClip()delete bullet object$!game["bullet"+game.bullets[i].id] remove bullet from bullets Array)game.bullets.splice(i, 1)check if we have shot the enemy, var j = 0jKey.isDown(Key.SHIFT) and getTimer()>ob.lastshot+ob.shootspeed)_root.shoot(ob) do we jumpob.jump keyPressed_root.jump(ob)walk animation !keyPressed)ob.clip.char.gotoAndStop(1))ob.clip.char.play())_root.enemyBrain())_root.moveBullets()& make the map)(buildMap(_root["myMap"+game.currentMap])check if we are falling)fall(_root.char) --script--Ooot.moveChar(ob, -1, 0)  CDocumentPage Page 1Scene 1@u;A? Symbol 20bullet?bullet? Symbol 3empty;empty; Symbol 1tileFu;tileY? Symbol 4loaderX)8>C? Symbol 5startbutC?O? Symbol 11char f%?charS? Symbol 17enemy1w?enemy1w? Symbol 19enemy2s?enemy2? Symbol 12char_up C? Y? Symbol 13 char_grph %?#Y? Symbol 14 char_leftC?"UY? Symbol 15 char_downC?$YY? Symbol 21items?Mitems|K?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 CColorDef3PfP0PHP`Px333(3f<03CH3F`3Hxf0f30ff(0f5Hf<`f@x3330333xf3d03]H3Z`3Xx3333303f3PPH33Px`33Px33Pf30f33PHff3(PHf3<x`f3Cxf3Ffff`f03f0ffx0fkHfd`f`x3f033fPH3ffxPH3fdx`3f]x3fZff0f3fPHfff`ffP0xffPxffPH3HfHxH̙n`hx3H33x`3fx`3xx`3̙kx3dfHf3x`ff0xfx0xf̙dxf]`3`f``x`px3`33x3fx3x3xx3nf`f3xffxfxfxxfkx3xfxxxxx3x333f333xfxf3fffffxxH3 HfH(H2`8x`3 `f`̙`(`0xx3xfxx x(xPx3H33x`f3x`3(x`35x3<3`33xf3 x̙3x3(x323x33f3 333(xfH3fx`ff0xf(0xf<xfCf`3fxffx̙fxf(xf5fx3ffff ff((xH3x`f0x̙PPP`3xfx̙P̙(P<x3f̙(xx`3xfxPxPd`3xfx̙PPx3f(xx3fxx3f̙xx3ff`zf*](o"PublishQTProperties::QTSndSettingsCQTAudioSettingsxfxPxPd`3xfx̙PPx3f(xx3f