home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2006-06-13 | 38.9 KB | 1,313 lines
function EncrpytString(strVal) { var _loc7_ = "aHfEjcDebChGiAfIjDbEjacD"; var _loc8_ = _loc7_.length; var _loc11_ = "0"; var _loc3_ = ""; var _loc9_ = strVal.length; var _loc1_ = 0; _loc3_ = ""; var _loc4_ = undefined; var _loc6_ = undefined; var _loc2_ = undefined; var _loc5_ = 0; nCnt = 0; while(nCnt < _loc9_) { _loc4_ = strVal.charCodeAt(nCnt); if(_loc4_ >= 128) { _loc4_ = "X"; } _loc6_ = _loc7_.charCodeAt(_loc1_); _loc1_ += 1; if(_loc1_ >= _loc8_) { _loc1_ = 0; } _loc2_ = _loc4_ % 16 + _loc6_; _loc3_ += String.fromCharCode(_loc2_); _loc5_ += _loc2_; _loc6_ = _loc7_.charCodeAt(_loc1_); _loc1_ += 1; if(_loc1_ >= _loc8_) { _loc1_ = 0; } _loc2_ = Math.floor(_loc4_ / 16) + _loc6_; _loc3_ += String.fromCharCode(_loc2_); _loc5_ += _loc2_; nCnt++; } _loc5_ %= 256; _loc6_ = _loc7_.charCodeAt(_loc1_); _loc1_ += 1; if(_loc1_ >= _loc8_) { _loc1_ = 0; } _loc2_ = _loc5_ % 16 + _loc6_; _loc3_ += String.fromCharCode(_loc2_); _loc6_ = _loc7_.charCodeAt(_loc1_); _loc1_ += 1; if(_loc1_ >= _loc8_) { _loc1_ = 0; } _loc2_ = Math.floor(_loc5_ / 16) + _loc6_; _loc3_ += String.fromCharCode(_loc2_); return _loc3_; } function AppendUrlParam(strUrl, strParam) { if(strUrl.indexOf("?") > 0) { return strUrl + "&" + strParam; } return strUrl + "?" + strParam; } function GetUrlParam(strUrl, strParam) { var _loc4_ = strUrl.toLowerCase(); var _loc1_ = _loc4_.indexOf(strParam); var _loc5_ = strParam.length; if(_loc1_ > 0) { var _loc3_ = undefined; var _loc2_ = _loc4_.indexOf("&",_loc1_ + _loc5_); if(_loc2_ > 0) { _loc3_ = _loc2_ - _loc1_; } else { _loc3_ = strUrl.length - _loc1_; } return strUrl.substr(_loc1_ + _loc5_,_loc3_); } return ""; } function GetBaseUrl(strUrl) { var _loc1_ = strUrl.toLowerCase(); var _loc2_ = _loc1_.length; var _loc3_ = _loc1_.indexOf("?",0); if(_loc3_ > 0) { _loc2_ = _loc3_; } var _loc4_ = "download"; if(_loc1_.substr(0,4) == "http") { _loc4_ = strUrl.substr(7,_loc2_ - 7); } return _loc4_; } function formatTime(seconds) { var _loc6_ = false; if(seconds < 0) { _loc6_ = true; seconds = Math.abs(seconds); } var _loc3_ = (seconds % 60).toString(); if(_loc3_.length == 1) { _loc3_ = "0" + _loc3_; } var _loc5_ = Math.floor(seconds / 3600).toString(); if(_loc5_ > 0) { var _loc1_ = (Math.floor(seconds / 60) % 60).toString(); if(_loc1_.length == 1) { _loc1_ = "0" + _loc1_; } var _loc4_ = _loc5_ + ":" + _loc1_ + ":" + _loc3_; } else { _loc1_ = Math.floor(seconds / 60).toString(); _loc4_ = _loc1_ + ":" + _loc3_; } if(_loc6_) { _loc4_ = "-" + _loc4_; } return _loc4_; } function setgamequality(q) { _root.gamequality = q; if(q == 1) { background.b1._visible = true; background.b2._visible = true; background.t1._visible = true; background.t2._visible = true; background.m1._visible = true; background.m2._visible = true; } else if(q == 2) { background.b1._visible = false; background.b2._visible = false; background.t1._visible = true; background.t2._visible = true; background.m1._visible = true; background.m2._visible = true; } else if(q == 3) { background.b1._visible = false; background.b2._visible = false; background.t1._visible = true; background.t2._visible = true; background.m1._visible = false; background.m2._visible = false; } } function resetSounds() { chime1 = new Sound(sounds.chime); chime1.attachSound("chime1"); chime1.setVolume(30 * sfxmute); chime2 = new Sound(sounds.chime); chime2.attachSound("chime2"); chime2.setVolume(30 * sfxmute); coinexplode = new Sound(sounds.coinexplode); coinexplode.attachSound("coinexplode"); coinexplode.setVolume(40 * sfxmute); cashregister = new Sound(sounds.cashregister); cashregister.attachSound("cashregister"); cashregister.setVolume(60 * sfxmute); coinbounce1 = new Sound(sounds.coinbounce); coinbounce1.attachSound("coinbounce1"); coinbounce1.setVolume(40 * sfxmute); coinbounce2 = new Sound(sounds.coinbounce); coinbounce2.attachSound("coinbounce2"); coinbounce2.setVolume(40 * sfxmute); smash = new Sound(sounds.smashmc); smash.attachSound("clocktick"); smash.setVolume(0 * sfxmute); smallhit = new Sound(sounds.hitmc); smallhit.attachSound("smallhitpiece"); smallhit.setVolume(30 * musicmute); bighit = new Sound(sounds.hitmc); bighit.attachSound("bighitpiece"); bighit.setVolume(30 * musicmute); medhit = new Sound(sounds.hitmc); medhit.attachSound("mediumhitpiece"); medhit.setVolume(30 * musicmute); medbighit = new Sound(sounds.hitmc); medbighit.attachSound("mediumbighitpiece"); medbighit.setVolume(30 * musicmute); } HiScoreSaveURL = "http://www.arcadetown.com/blackknight/hs.asp"; HiScoreOpenURL = "http://www.arcadetown.com/blackknight/view_high_scores.asp"; LinkDownload = "http://www.arcadetown.com/partner/download.asp?gameid=blackknight&aid=" + GetUrlParam(_url,"aid=") + "&refer=" + _root.GetBaseUrl(_url); LinkMoreGames = "http://www.arcadetown.com/index.asp?gameid=blackknight&aid=" + GetUrlParam(_url,"aid=") + "&refer=" + _root.GetBaseUrl(_url); LinkArcadetown = LinkMoreGames; sfxmute = 1; musicmute = 1; curweapon = 1; basespeed = 1.3; destp = 0; penalty = 0; char1.gotoAndStop(2); cansound = true; rootonMouseDown = function() { if(penalty == 0 && !flying && piggy == 0) { char1.hitting = true; didhit = false; char1.gotoAndStop(10); holding = true; destp = 21; combocount = 0; cansound = true; powerlevel = 0; } }; rootonMouseUp = function() { if(holding) { secondhits = 0; if(powerup > 12 && penalty == 0) { char1.hitting = true; char1.gotoAndStop(9); penalty = 0; flying = true; farleft = char1._x; cansound = true; } powerlevel = powerup; destp = 0; holding = false; } }; powermult = new Array(0,0,2,5,10); hittermove = function() { if(char1.hitting && _root.canhit) { if(this._x > 10 && this.invincible == 0 && this._visible && (this.hitTest(char1.anim.arm.club.hitregion) || flying && this._x < char1._x + 200 && this._x > farleft - 50)) { didhit = true; if(flying) { secondhits++; this.hits = 0; } if(this.hits <= 0) { consecutive++; combocount++; } extracoins = 0; if(combocount > 1) { extracoins = combocount; _root.levelshower.label.l_txt.text = "+" + extracoins * 10 + " Smash Bonus!"; _root.levelshower.gotoAndPlay(2); } this.hits -= curweapon / 2; var _loc4_ = Math.floor(powerup / 3) + 1; if(_loc4_ == 1 && cansound) { cansound = false; _root.smallhit.start(0,0); } else if(_loc4_ == 2 && cansound) { cansound = false; _root.medhit.start(0,0); } else if(_loc4_ == 3 && cansound) { cansound = false; _root.medbighit.start(0,0); } else if(_loc4_ >= 4 && cansound) { cansound = false; _root.bighit.start(0,0); } if(this.hits > 0) { this.dx = 30; this.dy = -10; this.invincible = 30; this.hs.start(0,0); } else { var _loc6_ = Math.floor(powerlevel / 6) + 1; extracoins += (curweapon - 1) * curweapon; if(this.coins == -1) { makeCoins(this._x,this._y,random(7 + 15 * hasamulet) + powermult[_loc6_] + extracoins); } else { makeCoins(this._x,this._y,this.coins + powermult[_loc6_] + extracoins); } if(this.pcount > 0) { makeExplosion(this._x,this._y,this.particle,this.pcount,this.gravity); } else if(this.pcount <= 0) { if(this.drawlayer == 0) { var _loc5_ = backexplosions; } else { _loc5_ = explosions; } if(flying && this.bighit != "") { var _loc3_ = _loc5_.attachMovie(this.bighit,"p" + curpart,curpart); } else { _loc3_ = _loc5_.attachMovie(this.particle,"p" + curpart,curpart); } if(this.pcount == -1) { _loc3_.gotoAndStop(_root.gamequality); explode(_loc3_); } _loc3_._x = this._x; _loc3_._y = this._y; _loc3_.dx = 5; _loc3_.onEnterFrame = function() { this._x -= this.dx * _root.smult; if(this._x < - this._width) { this.removeMovieClip(); } }; curpart++; } if(this.particle == "barrelpiece" && random(5) == 2) { bonus._x = this._x; bonus._y = this._y; bonus.dx = 25; bonus.dy = -14; bonus.gotoAndStop(random(3) + 1); bonus.onEnterFrame = function() { this._x += this.dx * _root.smult; this._y += this.dy; this.dy += 1; this.dx = this.dx - 1; if(this._y > 337) { this._y = 337; this.dy = 0; } if(this.dx < -5) { this.dx = -5; } if(this.hitTest(char1) && this.dx == -5) { if(this._currentframe == 1) { amuleticon._visible = true; hasamulet = true; } else if(this._currentframe == 2) { oilicon._visible = true; hasoil = true; } else if(this._currentframe == 3) { tonicicon._visible = true; hastonic = true; } this._x = -100; delete this.onEnterFrame; } }; } this.s.start(0,0); this.init(); this._visible = false; numhit++; score += this.points * 10 * combocount; updateText(); } } } if(this.invincible > 0) { this.invincible = this.invincible - 1; } if(this.dx > 0) { this._x += this.dx; this.dx = this.dx - 1; this.who._rotation += 12; } this._y += this.dy; this.dy = this.dy + 1; if(this._y > 317) { this._y = 317; this.dy = 0; } if(this._x < - this._width) { this.removeMovieClip(); } this._x -= this.spd * _root.smult; }; numparts = 10; curpart = 0; maxparts = 150; makeExplosion = function(x, y, piece, pcnt, grav) { var _loc3_ = 0; while(_loc3_ < pcnt) { var _loc2_ = explosions.attachMovie(piece,"p" + curpart,curpart); _loc2_._x = x; _loc2_._y = y; _loc2_.dx = -3 + _loc3_ * 1.5; _loc2_.dy = - Math.random() * 20 - 10; _loc2_.dr = - random(20) - 20; _loc2_._rotation = random(180); if(grav == 1) { _loc2_.dx = -1 + _loc3_ * 0.5; _loc2_.dy = - Math.random() * 10 - 8; _loc2_.dr = -10; } else if(grav == 0) { var _loc4_ = Math.random() * 5 + 2; var _loc5_ = Math.random() * 6.28; _loc2_.dx = Math.cos(_loc5_) * _loc4_; _loc2_.dy = Math.sin(_loc5_) * _loc4_; _loc2_.dr = 0; } _loc2_.gr = grav; _loc2_.onEnterFrame = function() { this._x += this.dx * basespeed; this._y += this.dy * basespeed; this.dy += this.gr * basespeed; if(this.gr == 1 && this.dy > 4) { this.dy = 4; } this._rotation += this.dr; if(this._y > 400) { this.removeMovieClip(); } if(this.gr == 0) { this._alpha -= 3; if(this._alpha <= 0) { this.removeMovieClip(); } } }; curpart++; curpart %= maxparts; _loc3_ = _loc3_ + 1; } }; explode = function(mc) { for(var _loc3_ in mc) { if(typeof mc[_loc3_] == "movieclip") { mc[_loc3_].dx = Math.random() * 10 - 3; mc[_loc3_].dy = Math.random() * 20 - 20; mc[_loc3_].dr = Math.random() * 20 - 10; mc[_loc3_].onEnterFrame = function() { this._x += this.dx * basespeed; this._y += this.dy * basespeed; this.dy += 1 * basespeed; this._rotation += this.dr; if(this._y > 200) { delete this.onEnterFrame; this.removeMovieClip(); } }; } } }; moneyValues = new Array(1,5,10); makeCoins = function(x, y, inpcnt) { var _loc10_ = Math.ceil(inpcnt / 2); var _loc6_ = new Array(); var _loc9_ = _loc10_; _loc6_[2] = Math.floor(_loc9_ / 10); _loc9_ -= _loc6_[2] * 10; _loc6_[1] = Math.floor(_loc9_ / 5); _loc9_ -= _loc6_[1] * 5; _loc6_[0] = _loc9_; if(_loc6_[0] > 2) { _loc6_[0] = 0; _loc6_[1] = _loc6_[1] + 1; } if(random(3) == 1) { coinexplode.start(0,0); } var _loc4_ = 0; while(_loc4_ < _loc6_.length) { var _loc5_ = 0; while(_loc5_ < _loc6_[_loc4_]) { var _loc3_ = explosions.attachMovie("coin" + _loc4_,"p" + curpart,curpart); _loc3_.gotoAndPlay(random(5) + 1); _loc3_._x = x; _loc3_._y = y; _loc3_._xscale = _loc3_._yscale = 125; _loc3_.dx = Math.random() * 10 + 14; _loc3_.dy = - Math.random() * 10 - 3; _loc3_.dr = - random(20) - 20; _loc3_.val = moneyValues[_loc4_]; _loc3_.onEnterFrame = function() { this._x += this.dx * basespeed; this._y += this.dy * basespeed; this.dy += 0.5 * basespeed; this.dx *= 0.96; this._x -= 5 * _root.smult; if(this._y > 365) { this.dy *= -0.5; this._y = 365; if(this.dy < -2 && random(9) == 1) { if(random(2) == 0) { coinbounce1.start(0,0); } else { coinbounce2.start(0,0); } } } if(this._x < char1._x + 70 && this.dx < 5) { this.dx = (bag._x + bag._width / 2 - this._x) / 25; this.dy = (bag._y + bag._height / 2 - this._y) / 25; this.cnt = 25; if(random(2) == 1) { cashregister.start(0,0); } this.onEnterFrame = function() { this._x += this.dx; this._y += this.dy; this.cnt = this.cnt - 1; if(this.cnt == 0) { money += this.val; updateText(); this.removeMovieClip(); } }; } }; curpart++; curpart %= maxparts; _loc5_ = _loc5_ + 1; } _loc4_ = _loc4_ + 1; } }; initMe = function(which) { this.gotoAndStop(which); this.spd = speeds[this._currentframe]; this.particle = particles[this._currentframe]; this.bighit = bighits[this._currentframe]; this.pcount = partcount[this._currentframe]; this.hits = requiredhits[this._currentframe]; this.points = pointvalue[this._currentframe]; this.breaksound = breaksounds[this._currentframe]; this.hitsound = hitsounds[this._currentframe]; this.coins = coinvalue[this._currentframe]; this.gravity = gravities[this._currentframe]; this.drawlayer = drawlayers[this._currentframe]; if(this.pcount == -1) { this.whox.gotoAndStop(3); } if(sfxmute) { this.s = new Sound(this); this.s.setVolume(80 * sfxmute); this.hs = new Sound(this); this.hs.setVolume(80 * sfxmute); } if(this.hitsound == "barrelbreak") { this.hs.setVolume(40 * sfxmute); } if(this.breaksound == "barrelbreak") { this.s.setVolume(40 * sfxmute); } if(this.hitsound == "manhit" || this.hitsound == "womanhit" || this.hitsound == "oldmanhit" || this.hitsound == "oldwomanhit") { var _loc2_ = random(4); if(_loc2_ < 2) { this.hitsound += _loc2_; this.breaksound += _loc2_; } else { this.hitsound = "manhit"; this.hitsound = "manhit"; } this.s.setVolume(110 * sfxmute); this.hs.setVolume(110 * sfxmute); } this.s.attachSound(this.breaksound); this.hs.attachSound(this.hitsound); this.invincible = 0; }; speeds = new Array(); particles = new Array(); bighits = new Array(); gravities = new Array(); hitsounds = new Array(); breaksounds = new Array(); partcount = new Array(); requiredhits = new Array(); pointvalue = new Array(); coinvalue = new Array(); drawlayers = new Array(); var icnt = 0; newItemType = function(mspeeds, mparticles, mbighits, mgravities, mhitsounds, mbreaksounds, mpartcount, mrequiredhits, mpointvalue, mcoinvalue, mlayer) { speeds[icnt] = mspeeds; particles[icnt] = mparticles; bighits[icnt] = mbighits; gravities[icnt] = mgravities; hitsounds[icnt] = mhitsounds; breaksounds[icnt] = mbreaksounds; partcount[icnt] = mpartcount; requiredhits[icnt] = mrequiredhits; pointvalue[icnt] = mpointvalue; coinvalue[icnt] = mcoinvalue; drawlayers[icnt] = mlayer; icnt++; }; newItemType(0,"","",0,"","",0,0,0,0,1); newItemType(6,"redbird","",1,"bird2","bird2",6,1,10,2,1); newItemType(5,"bluebird","",1,"bird2","bird2",6,0,5,1,1); newItemType(7,"oldmanhit","oldmanhitbig",2,"oldmanhit","oldmanhit",0,0,5,1,1); newItemType(5,"barrelpiece","",2,"thud","barrelbreak",6,1.5,5,-1,1); newItemType(5,"treefall","treefallbig",2,"thud","thud",0,0,5,1,1); newItemType(7,"doghit","",2,"dogyelp","dogyelp",0,0,5,1,1); newItemType(7,"pighit","",2,"pigsqueal","pigsqueal",0,1,10,1,1); newItemType(5,"hayparticle","",1,"thud","thud",9,0,5,2,0); newItemType(8,"blackbird","",1,"crow","crow",6,1.5,10,3,1); newItemType(7,"oldmanworld2hit","oldmanworld2hitbig",2,"oldmanhit","oldmanhit",0,0,5,1,1); newItemType(7,"youngwomanhit","youngwomanhitbig",2,"womanhit","womanhit",0,0,5,2,1); newItemType(7,"youngwomanworld2hit","youngwomanworld2hitbig",2,"womanhit","womanhit",0,0,5,2,1); newItemType(6,"oldwomanhit","oldwomanhitbig",2,"oldwomanhit","oldwomanhit",0,0,5,1,1); newItemType(6,"oldwomanworld2hit","oldwomanworld2hitbig",2,"oldwomanhit","oldwomanhit",0,0,5,1,1); newItemType(7,"youngmanhit","youngmanhitbig",2,"manhit","manhit",0,0,10,2,1); newItemType(7,"youngmanworld2hit","youngmanworld2hitbig",2,"manhit","manhit",0,0,10,2,1); newItemType(5,"bucketparticle","",2,"thud","barrelbreak",6,0,5,2,1); newItemType(5,"world1smallpotpiece","",2,"barrelbreak","barrelbreak",6,0,5,5,1); newItemType(5,"world1bigpotpiece","",2,"barrelbreak","barrelbreak",6,1,10,7,1); newItemType(5,"rockparticle","",2,"thud","thud",5,0,5,2,0); newItemType(5,"scarecrow","",2,"thud","thud",-1,0,5,3,1); newItemType(5,"suitofarmor","",2,"armor","armor",-1,0,5,4,0); newItemType(5,"chair","",2,"barrelbreak","barrelbreak",-1,0,5,2,0); newItemType(5,"bigcandle","",2,"barrelbreak","barrelbreak",-1,0,5,3,0); newItemType(7,"oldmanworld3hit","oldmanworld3hitbig",2,"oldmanhit","oldmanhit",0,0,5,2,1); newItemType(6,"oldwomanworld3hit","oldwomanworld3hitbig",2,"oldwomanhit","oldwomanhit",0,0,5,5,1); newItemType(7,"youngmanworld3hit","youngmanworld3hitbig",2,"manhit","manhit",0,0,5,4,1); newItemType(7,"youngwomanworld3hit","youngwomanworld3hitbig",2,"womanhit","womanhit",0,0,5,3,1); newItemType(5,"world3bluevasepiece","",2,"barrelbreak","barrelbreak",5,0,5,4,1); newItemType(5,"world3redvasepiece","",2,"barrelbreak","barrelbreak",5,1,10,7,1); newItemType(5,"boxshoppe","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(7,"witchmad","witchmad",2,"witchhit","witchhit",0,0,0,0,1); newItemType(5,"watermelonstand","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"fragileshop","",2,"glassbreak","glassbreak",-1,0,10,10,0); newItemType(5,"cutefurrystand","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"dungeonshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"crateshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"farmersmarket","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"blacksmith","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"cartwheels","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"souvenirshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"mapstours","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"banquetsmash","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); newItemType(5,"bookshelfsmash","",2,"barrelbreak","barrelbreak",-1,0,10,10,0); world = 1; worldCreatures = new Array(); worldCreatures[1] = new Array([1],[2],[3],[4],[36,35],[5],[11],[13],[15],[18],[19],[1],[2],[3],[4],[5],[33,34],[11],[13],[15],[18],[19],[1],[2],[3],[4],[5],[11],[13],[15],[18],[19],[32]); worldCreatures[2] = new Array([4],[8],[9],[10],[37,38],[12],[14],[16],[17],[20],[21],[4],[8],[9],[10],[40,39],[12],[14],[16],[17],[20],[21],[4],[8],[9],[10],[12],[14],[16],[17],[20],[21],[32]); worldCreatures[3] = new Array([4],[22],[23],[41,42],[24],[25],[26],[27],[28],[29],[30],[4],[22],[23],[43,44],[24],[25],[26],[27],[28],[29],[30],[4],[22],[23],[24],[25],[26],[27],[28],[29],[30],[32]); consecutives = new Array("Combo!","Double Combo!","Triple Combo!","Smash Combo!","Super Smash Combo!","Medieval Combo!","Regal Combo!","Royal Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!"); tipMessages = new Array("Try not to swing and miss, always aim for a target!","Click and hold down mouse button to power up and Get Medieval!","Smash all the items in a shop for extra gold!","Watch out for Matilda the witch, sheΓÇÖll zap you if you hit her!","Buy bigger weapons in Ye Olde Weapon Shoppe to do more damage!","Armor Oil helps you recover faster from a missed swing!","The Lucky Medallion will get you more gold with each swing!","The Strength Potion helps you Get Medieval faster!","Who said taxes aren\'t fun?","Order \'Heroing for Dummies\' Now!!!","Two things in life are certain, taxes and more taxes.","Two more things in life are certain, taxes and axes.","Open helmet before kissing maidens.","Do not kiss the frog.","Always put on gloves with the spikes pointing out.","Always wash your chain mail in cold water to avoid shrinkage.","The last knight to the round table clears it off after the feast.","A tax refund? Off with your head!","Laugh *with* the Jester, not at him, he is a tortured soul.","Ignore the funny man behind the curtain.","Warning: Objects in mirror may appear smashed.","1) Take single bite of pork leg. 2) Toss it over your shoulder."); lastone = 0; generateHitter = function() { myInterval(0,-100); lastone += random(2) + 1; lastone %= worldCreatures[world].length; var _loc4_ = lastone; var _loc5_ = 800 + random(300); timeadd = -1500; var _loc3_ = 0; while(_loc3_ < worldCreatures[world][_loc4_].length) { var _loc2_ = worldCreatures[world][_loc4_][_loc3_]; if(drawlayers[_loc2_] == 0) { var _loc1_ = backhitters.attachMovie("hitter_mc","hit" + hitternum,hitternum); } else { _loc1_ = hitters.attachMovie("hitter_mc","hit" + hitternum,hitternum); } _loc1_._y = 318; _loc1_._x = _loc5_; _loc1_.onEnterFrame = hittermove; _loc1_.init = initMe; if(_loc2_ != 32 || _loc2_ == 32 && level > 3) { _loc1_.init(_loc2_); } _loc5_ += _loc1_._width + 20; _loc1_.mynum = hitternum; hitternum++; lastGenerated = _loc1_; timeadd += 1500; _loc3_ = _loc3_ + 1; } hitgen = myInterval(generateHitter,1000 + timeadd); }; _root.createEmptyMovieClip("myintervalmc",2345); myInterval = function(func, delay) { myintervalmc.func = func; myintervalmc.delay = Math.floor(delay / 20); }; myintervalmc.onEnterFrame = function() { if(this.delay == 0) { this.func(); this.delay = this.delay - 1; } else if(this.delay > 0) { this.delay = this.delay - 1; } }; updateText = function() { status_txt.text = money * 10 + " of " + hittarget * 10; lev_txt.text = "Level " + level; score_txt.text = score + " pts"; }; _root.smult = basespeed; _root.setMask("mainmask"); _root.createEmptyMovieClip("sounds",399); sounds.createEmptyMovieClip("smashmc",0); sounds.createEmptyMovieClip("songmc",1); sounds.createEmptyMovieClip("hitmc",2); sounds.createEmptyMovieClip("chime",3); sounds.createEmptyMovieClip("coinexplode",4); sounds.createEmptyMovieClip("cashregister",5); sounds.createEmptyMovieClip("coinbounce",6); sounds.createEmptyMovieClip("objsounds",7); sounds.createEmptyMovieClip("talkmc",8); resetSounds(); titlescreen.swapDepths(101); goalscreen.swapDepths(99); weaponshop.swapDepths(98); story.swapDepths(97); instructions.swapDepths(96); nextlevel = function() { world++; if(world > 3) { world = 1; } var _loc2_ = 0.5 + percplus / 7; if(_loc2_ > 1.1 && curweapon < 6) { _loc2_ = 1.1; } if(_loc2_ > 1 && curweapon == 6) { _loc2_ = 1; } percplus++; var _loc3_ = Math.floor(mostgot * _loc2_); var _loc4_ = level * 20 + 35 + (curweapon - 1) * _loc2_ * 60; if(_loc3_ < _loc4_) { _loc3_ = _loc4_; } hittarget += _loc3_; if(hittarget < money + level * 50) { hittarget = money + level * 50; } hittarget = Math.floor(hittarget / 5) * 5; startamount = money; numhit = 0; level++; updateText(); _root.smult = 0; distwalked = 0; maxtime = 60; piggy = 0; song.stop(); song = new Sound(sounds.songmc); song.attachSound("transitionsong"); song.setVolume(50 * musicmute); song.start(0,9999); _root.createEmptyMovieClip("backexplosions",5); _root.createEmptyMovieClip("explosions",7); background.farback.gotoAndStop(world); background.m1.gotoAndStop(world); background.m2.gotoAndStop(world); background.m1.x = 0; background.m2.x = background.m1._width - 4; background.t1.gotoAndStop(world); background.t2.gotoAndStop(world); background.g1.gotoAndStop(world); background.g2.gotoAndStop(world); background.b1.gotoAndStop(7 * (world - 1) + 1); background.b2.gotoAndStop(7 * (world - 1) + 1); delete _root.onMouseUp; delete _root.onMouseDown; delete char1.onEnterFrame; amuleticon._visible = hasamulet; oilicon._visible = hasoil; tonicicon._visible = hastonic; _quality = "HIGH"; goalscreen.parchment.gotoAndPlay(1); goalscreen.hiscorebox._visible = false; goalscreen.parchment.page.title_txt.text = "Thy Goal"; goalscreen.parchment.page.missiontext.text = "Thou Must Collect " + hittarget * 10 + " Gold Pieces in Tax for thy King."; if(level < tipMessages.length) { goalscreen.parchment.page.tip_txt.text = "Tip: " + tipMessages[level - 1]; } else { goalscreen.parchment.page.tip_txt.text = ""; } goalscreen.onRelease = function() { song.stop(); song2 = new Sound(sounds.songmc); song2.attachSound("song" + world); song2.setVolume(50 * musicmute); song2.start(0,9999); _root.smult = basespeed; stime = getTimer(); levelshower.label.l_txt.text = "Round " + level; levelshower.gotoAndPlay(2); destp = 0; penalty = 0; char1.gotoAndStop(2); cansound = true; consecutive = 0; holding = false; spacebar = false; powerup = 0; numhit = 0; char1._x = char1.sx; _root.onMouseUp = rootonMouseUp; _root.onMouseDown = rootonMouseDown; char1.onEnterFrame = char1onEnterFrame; _root.createEmptyMovieClip("backhitters",4); _root.createEmptyMovieClip("hitters",6); hitternum = 0; hitgen = myInterval(generateHitter,1000); generateHitter(); circlewipe(goalscreen); delete goalScreen.onRelease; }; }; doGoalMet = function() { _quality = "HIGH"; _root.smult = 0; goalscreen.parchment.gotoAndPlay(1); goalscreen.hiscorebox._visible = false; goalscreen.parchment.page.title_txt.text = "Thy Results"; goalscreen.parchment.page.missiontext.text = "Thou hast collected " + money * 10 + " Gold Pieces. Thy King is pleased."; goalscreen.parchment.page.tip_txt.text = ""; lastroundgot = money - startamount; if(lastroundgot > mostgot) { mostgot = lastroundgot; } goalscreen.onRelease = function() { doWeaponShop(); delete goalScreen.onRelease; }; circlewipe(undefined,goalscreen); }; doGoalFail = function() { _root.smult = 0; song.stop(); song2 = new Sound(sounds.songmc); song2.attachSound("firedmusic"); song2.setVolume(50 * musicmute); song2.start(0,9999); smash.setVolume(0); _quality = "HIGH"; goalscreen.parchment.gotoAndPlay(1); goalscreen.parchment.page.title_txt.text = "Thy Pink Slip"; goalscreen.parchment.page.missiontext.text = "Thou did not collect enough tribute! Thou art Fired!"; goalscreen.parchment.page.tip_txt.text = ""; delete goalscreen.onRelease; goalscreen.onRelease = function() { goalscreen.hiscorebox._visible = true; goalscreen.hiscorebox.score_txt.text = money * 10; delete goalscreen.onRelease; }; circlewipe(undefined,goalscreen); }; doWeaponShop = function() { song.stop(); song2 = new Sound(sounds.songmc); song2.attachSound("shopmusic"); song2.setVolume(50 * musicmute); song2.start(0,9999); weaponshop.weapon7._visible = true; weaponshop.weapon8._visible = true; weaponshop.weapon9._visible = true; hasamulet = false; hasoil = false; hastonic = false; circlewipe(goalscreen,weaponshop); weaponshop.init(); weaponshop.doneButton.onRelease = function() { nextlevel(); circlewipe(weaponshop,goalscreen); delete this.onRelease; }; }; _quality = "HIGH"; levelshower.stop(); consecshower.stop(); char1.sx = char1._x; char1.sy = char1._y; char1.swapDepths(10); char1.yoff = 0; char1.dy = 0; makePiggy = function() { piggy = 120; flying = false; powerup = 0; destp = 0; holding = false; char1.hitting = false; char1.gotoAndStop(11); makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0); }; char1onEnterFrame = function() { var _loc3_ = Key.isDown(32); if(!spacebar && _loc3_) { spacebar = true; _root.onMouseDown(); } if(spacebar && !_loc3_) { spacebar = false; _root.onMouseUp(); } sec = maxtime - Math.floor((getTimer() - stime) / 1000); timedisp_txt.text = formatTime(sec); if(piggy > 0) { piggy--; if(piggy == 1) { makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0); this.gotoAndStop(1); } } if(sec < 8) { smash.setVolume((8 - sec) * 20); } else { smash.setVolume(0); } if(sec < 0) { myInterval(0,-100); levelshower.label.l_txt.text = "Time Up"; timedisp_txt.text = "0:00"; levelshower.gotoAndPlay(2); smash.setVolume(0); this.onEnterFrame = function() { var _loc3_ = Key.isDown(32); if(!spacebar && _loc3_) { spacebar = true; _root.onMouseDown(); } if(spacebar && !_loc3_) { spacebar = false; _root.onMouseUp(); } if(piggy > 0) { piggy--; if(piggy == 1) { makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0); this.gotoAndStop(1); } } if(destp > powerup) { powerup += (destp - powerup) * (0.06 + hastonic * 0.07); } else { powerup -= 1; } this.yoff += this.dy; this.dy += 2; if(this.yoff > 0) { this.yoff = 0; this.dy = 0; } if(powerup > 20) { powerup = 20; } if(powerup < 0) { powerup = 0; } pwrchar1.powerbar._xscale = powerup * 5; if(powerup == 20) { if(penalty > 1) { penalty = 1; } pwrchar1.gethim._visible = true; } else { pwrchar1.gethim._visible = false; } this.glow._alpha = powerup * powerup / 4; if(penalty > 1) { char1.gotoAndStop(4); penalty--; } else if(penalty == 1) { char1.gotoAndStop(10); char1.anim.gotoAndPlay(13); penalty = 0; } this._x += 5; if(this._x > 800) { delete _root.onMouseDown; delete _root.onMouseUp; if(money >= hittarget) { doGoalMet(); } else { doGoalFail(); } delete this.onEnterFrame; } }; } if(destp > powerup) { powerup += (destp - powerup) * (0.06 + hastonic * 0.07); } else { if(powerup > 10) { this._x = this.sx - (powerup - 10) * 9; } powerup -= 1; } this.yoff += this.dy; this.dy += 2; if(this.yoff > 0) { this.yoff = 0; this.dy = 0; } if(powerup > 20) { powerup = 20; } if(powerup < 0) { powerup = 0; } pwrchar1.powerbar._xscale = powerup * 5; if(powerup == 20) { if(penalty > 1) { penalty = 1; } pwrchar1.gethim._visible = true; } else { pwrchar1.gethim._visible = false; } if(powerup > 10) { this._x = this.sx - (powerup - 10) * 9; } this.glow._alpha = powerup * powerup / 4; if(penalty > 1) { char1.gotoAndStop(4); penalty--; } else if(penalty == 1) { char1.gotoAndStop(10); char1.anim.gotoAndPlay(13); penalty = 0; } }; beginGame = function() { stopAllSounds(); song = new Sound(sounds.songmc); song.attachSound("transitionsong"); song.setVolume(50 * musicmute); song.start(0,9999); story.talk.start(0,9999); story.talk.setVolume(0 * sfxmute); story.story.knight.play(); circlewipe(titlescreen,story); delete titlescreen.rays.onEnterFrame; story.story.onRelease = function() { score = 0; consecutive = 0; powerup = 0; hittarget = 0; money = 0; lastroundgot = 90; mostgot = 90; numhit = 0; level = 0; delete story.bubble.onEnterFrame; story.story.mouth.stop(); story.story.knight.stop(); story.talk.stop(); circlewipe(story,goalscreen); delete story.story.onRelease; nextlevel(); }; story.curstatement = 0; story.wait = 0; story.statement[7] = "The Queen needs a " + story.randoms[random(story.randoms.length)]; story.bubble.onEnterFrame = story.bubbleOnEnterFrame; curweapon = 1; world = 0; score = 0; consecutive = 0; powerup = 0; hittarget = 0; money = 0; numhit = 0; level = 0; percplus = 0; updateText(); _root.smult = 0; hasamulet = false; hasoil = false; hastonic = false; pwrchar1.gethim._visible = false; weaponshop.firstinit(); }; goalscreen.parchment.stop(); goalscreen._visible = false; weaponshop._visible = false; instructions._visible = false; story._visible = false; _root.smult = 0; stop(); doinstructions = function() { instructions.gotoAndStop(1); instructions.hand.play(); instructions.knight.play(); circlewipe(titlescreen,instructions); }; bigcircle._visible = false; circlewipe = function(inmc, outmc) { _level0.setMask(bigcircle); bigcircle.onEnterFrame = function() { this._xscale -= 10; this._yscale -= 10; if(this._xscale <= 0) { if(inmc == goalscreen) { _quality = "LOW"; } if(outmc == goalscreen || outmc == titlescreen || outmc == weaponshop) { _quality = "HIGH"; } inmc._visible = false; outmc._visible = true; this.onEnterFrame = function() { this._xscale += 10; this._yscale += 10; if(this._xscale >= 100) { _level0.setMask(null); delete this.onEnterFrame; } }; } }; }; g = getTimer(); var i = 0; while(i < 10000) { b = Math.sin(Math.random()); i++; } diff = getTimer() - g; if(diff < 180) { setgamequality(1); } else if(diff > 230) { setgamequality(3); } else { setgamequality(2); } Stage.scaleMode = "noscale";