home *** CD-ROM | disk | FTP | other *** search
Text File | 2008-09-23 | 48.4 KB | 2,035 lines |
- function updateHUD()
- {
- if(d.powa >= 100 && !hud.pbar.cycle)
- {
- hud.pbar.gotoAndPlay(2);
- hud.pbar.cycle = true;
- }
- else
- {
- hud.pbar.cycle = false;
- hud.pbar.gotoAndStop(1);
- }
- hud.numlives = ": " + this.lives;
- hud.score = "XP:" + this.score;
- if(this.nex != undefined)
- {
- hud.nex = "NEXT: " + this.nex;
- }
- else
- {
- hud.nex = "MAXED OUT";
- }
- hud.lbar._xscale = d.life / d.maxlife * 100;
- hud.pbar._xscale = d.powa;
- hud.bbar._xscale = b.life / b.maxlife * 100;
- if(hud.bbar._xscale < 0)
- {
- hud.bbar._xscale = 0;
- }
- if(this.score >= this.nex && !summoning && this.nex != undefined)
- {
- flashIt();
- blackOut();
- summoning = true;
- this.pausy = true;
- if(this.lev <= 2)
- {
- lut = this.attachMovie("leveluptext","lup",789);
- }
- else
- {
- lut = this.attachMovie("fabuloustext","lup",789);
- }
- lut._y = 20;
- g = wrap.attachMovie("summon","summon",777);
- g._xscale = 87;
- g._yscale = g._xscale;
- g._x = d._x - 30;
- g._y = d._y + 20;
- }
- }
- function blackOut()
- {
- bgmusic.stop();
- if(this.lev <= 2)
- {
- wrap.blackout.gotoAndPlay(2);
- }
- else
- {
- wrap.blackout2.gotoAndPlay(2);
- }
- i = 0;
- while(i < stones.length)
- {
- yib = stones[i];
- yib._visible = false;
- i++;
- }
- }
- function switchGuy()
- {
- this.lev += 1;
- d.attachMovie("k" + dudes[this.lev],"guts",0);
- d.id = dudes[this.lev];
- }
- function endSummon()
- {
- stopAllSounds();
- if(!this.mute)
- {
- bgmusic.start(0,99);
- }
- hud.holder.guts.attachMovie("levicon" + this.lev,"guts",0);
- this.nex = levreqs[this.lev];
- hud.holder.gotoAndPlay(2);
- wrap.blackout.gotoAndStop(1);
- flashIt();
- this.pausy = false;
- summoning = false;
- i = 0;
- while(i < stones.length)
- {
- yib = stones[i];
- yib._visible = true;
- i++;
- }
- d.xvel = 0;
- d.anum = 0;
- }
- function phys(who)
- {
- if(who.blinking)
- {
- if(wrap.you._x == undefined)
- {
- yo = wrap.attachMovie("you","you",788766679);
- yo._xscale = 80;
- yo._yscale = yo._xscale;
- yo.onEnterFrame = function()
- {
- this._x = _root.d._x + 5;
- this._y = _root.d._y;
- if(!_root.d.blinking)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- };
- }
- who._visible = !who._visible;
- who.blinkcv = who.blinkcv + 1;
- if(who.blinkcv >= 70)
- {
- who.blinking = false;
- who._visible = true;
- }
- }
- if(who.inv)
- {
- who.invcv = who.invcv + 1;
- if(who.invcv >= 15)
- {
- who.invcv = 0;
- who.inv = false;
- }
- }
- if(!who.dead)
- {
- who.powa += who.regen;
- if(who.powa > 100)
- {
- who.powa = 100;
- }
- }
- else
- {
- who.life = 0;
- }
- updateHUD();
- if(!who.stoned)
- {
- who.xvel *= fric;
- who.yvel += grav;
- who._x += who.xvel;
- who._y += who.yvel;
- }
- who.virtx = wrap._x + who._x;
- who.virty = wrap._y + who._y;
- who.rig = who.virtx + 15;
- who.lef = who.virtx - 15;
- who.topp = who.virty - 70;
- while(wrap.bg.hitTest(who.virtx,who.topp,true))
- {
- who._y += 1;
- who.virty += 1;
- who.topp += 1;
- if(who.yvel < 0)
- {
- who.yvel *= -1;
- }
- }
- while(wrap.bg.hitTest(who.virtx,who.virty,true))
- {
- who._y -= 1;
- who.virty -= 1;
- who.topp -= 1;
- if(!who.squashed)
- {
- who.hurt = false;
- }
- if(!who.jlo)
- {
- who.yvel = 0;
- who.jlo = false;
- if(who.jumping && who.life > 0)
- {
- if(!who.attacking)
- {
- who.guts.gotoAndStop("landit");
- }
- else
- {
- jumpRecover(who);
- }
- }
- }
- if(who.life <= 0)
- {
- if(!d.carrot)
- {
- if(d.soundcount != 1)
- {
- cannot.start();
- d.soundcount = 1;
- }
- else
- {
- d.soundcount = 0;
- resistance.start();
- }
- d.carrot = true;
- }
- d.hurt = false;
- d.squashed = false;
- who.guts.gotoAndStop("ground");
- }
- }
- while(wrap.bg.hitTest(who.rig,who.virty - 25,true))
- {
- who.virtx -= 1;
- who._x -= 1;
- who.rig -= 1;
- who.xvel = 0;
- }
- while(wrap.bg.hitTest(who.lef,who.virty - 25,true))
- {
- who.virtx += 1;
- who._x += 1;
- who.lef += 1;
- who.xvel = 0;
- }
- if(!wrap.bg.hitTest(who.virtx,who.virty + 20,true))
- {
- who.jumping = true;
- }
- }
- function squashrecover(who)
- {
- who.attacking = false;
- who.squashed = false;
- who.hurt = false;
- who.guts.gotoAndStop("rest");
- }
- function controls(who)
- {
- if(!who.attacking)
- {
- if(Key.isDown(39))
- {
- who.xvel += who.speed;
- who._xscale = 100;
- if(!who.jumping)
- {
- who.guts.gotoAndStop("run");
- }
- }
- if(Key.isDown(37))
- {
- who.xvel -= who.speed;
- who._xscale = -100;
- if(!who.jumping)
- {
- who.guts.gotoAndStop("run");
- }
- }
- if(!Key.isDown(39) && !Key.isDown(37) && !who.jumping)
- {
- who.guts.gotoAndStop("rest");
- }
- if(Key.isDown(65))
- {
- if(who.powa > 3)
- {
- who.charge += 3;
- if(who.charge > 9)
- {
- who.powa -= 1;
- }
- }
- if(who.charge > 400)
- {
- who.charge = 400;
- }
- if(who.charge > 9)
- {
- i = 0;
- while(i < who.charge / 25)
- {
- t = wrap.attachMovie("twinkle","star" + starcv,starcv);
- starcv++;
- t._xscale = who.charge * 1.5;
- if(t._xscale > 200)
- {
- t._xscale = 200;
- }
- t.gotoAndPlay(random(3) + 1);
- t._yscale = t._xscale;
- t._x = who._x + (random(70) - 35);
- t._y = who._y - random(100);
- t.yvel = random(4);
- t.xvel = random(6) - 3;
- t.onEnterFrame = function()
- {
- this._y -= this.yvel;
- if(!this.esc)
- {
- this.yvel *= 0.9;
- this._alpha -= 10;
- }
- else
- {
- this._alpha -= 3;
- this.yvel -= 3;
- }
- this._x += this.xvel;
- this.xvel *= 0.9;
- if(_root.d.charge == 0 && !this.esc)
- {
- this.xvel *= 10;
- this.yvel *= random(20);
- if(_root.d._xscale == 100)
- {
- this._x += 90;
- }
- else
- {
- this._x -= 90;
- }
- this.esc = true;
- }
- if(this._alpha <= 10)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- };
- i++;
- }
- }
- }
- if(Key.isDown(65) && who.aup)
- {
- who.attacking = true;
- who.aup = false;
- who.guts.gotoAndStop("attack" + who.anum);
- who.anum += 1;
- if(who.anum == 3)
- {
- who.anum = 0;
- }
- if(who.jumping)
- {
- who.guts.gotoAndStop("airslash");
- }
- var sou = eval("swin" + who.anum);
- sou.start();
- }
- }
- if(!Key.isDown(65))
- {
- if(who.charge > 9)
- {
- who.guts.gotoAndStop("chargerelease");
- who.attacking = true;
- }
- else
- {
- who.charge = 0;
- }
- who.aup = true;
- }
- if(!Key.isDown(83))
- {
- who.sup = true;
- }
- if(!Key.isDown(JUMPBUT))
- {
- who.jup = true;
- }
- if(Key.isDown(JUMPBUT))
- {
- if(!who.jumping && who.jup)
- {
- who.jumping = true;
- if(!who.attacking)
- {
- who.guts.gotoAndStop("jumpload");
- }
- else
- {
- runJump(who);
- }
- who.jup = false;
- who.jlo = true;
- }
- }
- }
- function makeFireball(who)
- {
- flashIt();
- who.biggun = false;
- if(!who.biggun)
- {
- f = wrap.attachMovie("special" + who.id,"fireball",899);
- discharge.start();
- amt = who.charge * 0.5;
- f._xscale = amt;
- f._yscale = f._xscale;
- if(who._xscale == 100)
- {
- f.dir = 1;
- f._x = who._x + 150;
- }
- else
- {
- f.dir = -1;
- f._xscale = - amt;
- f._x = who._x - 150;
- }
- f._y = who._y - 30;
- f.onEnterFrame = function()
- {
- this._x += 6 * this.dir;
- testHit(this.hitzone,Math.abs(this._xscale / 90),this,true);
- };
- }
- if(who.powa < 0)
- {
- who.powa = 0;
- }
- who.charge = 0;
- }
- function flashIt()
- {
- wrap.flasher.gotoAndPlay(2);
- }
- function testHit(box, amt, who, cl)
- {
- if(!summoning && !d.dead)
- {
- i = 0;
- while(i < stones.length)
- {
- var bh = stones[i];
- if(bh.hitTest(box))
- {
- hit2.start();
- bh.inair = true;
- r = wrap.attachMovie("hitpoof","poof" + starcv,starcv + 999999);
- r._xscale = 70;
- r._yscale = r._xscale;
- if(who._xscale > 0)
- {
- bh.xvel += 7 + random(5);
- }
- else
- {
- bh.xvel -= 7 - random(5);
- }
- if(who._xscale > 0)
- {
- var pg = 10;
- bh._xscale = -100;
- }
- else
- {
- bh._xscale = 100;
- pg = -10;
- r._xscale = -70;
- }
- if(!cl)
- {
- r._x = bh._x + pg;
- var ix = r._x;
- }
- else
- {
- r._x = bh._x;
- var ix = r._x;
- }
- r._y = bh._y - 55;
- var iy = r._y;
- bh.yvel = -13;
- bh.juggle += 1;
- s = wrap.attachMovie("ptcounter","pcount" + i,8888888 + i);
- s._x = ix;
- s._y = iy;
- s.pt = "+ " + bh.juggle;
- s.cv = 0;
- s.onEnterFrame = function()
- {
- this._y -= 2;
- this.cv = this.cv + 1;
- if(this.cv >= 30)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- };
- this.score += bh.juggle;
- }
- i++;
- }
- if(wrap.bad.hitarea.hitTest(box) && !b.inv && !b.finaldead)
- {
- var ra = random(3);
- var plain = eval("hit" + ra);
- plain.start();
- var rak = random(10);
- if(rak > 7)
- {
- rak = 1;
- }
- var gil = eval("groan" + rak);
- gil.start();
- if(wrap.bad.expirecv <= 0 || wrap.bad.expirecv == undefined)
- {
- wrap.bad.pax = 1;
- }
- else if(!cl)
- {
- wrap.bad.pax += 1;
- }
- wrap.bad.expirecv = wrap.bad.maxexpire;
- wrap.bad.gotoAndPlay("hit");
- if(!b.attacking && !b.nohit)
- {
- wrap.bad.guts.gotoAndStop("hit");
- }
- wrap.bad.life -= amt;
- var dist = Math.abs(wrap.bad._x - who._x);
- if(who._xscale > 0)
- {
- wrap.bad.xvel = 7;
- }
- else
- {
- wrap.bad.xvel = -7;
- }
- if(!cl)
- {
- if(who._xscale > 0)
- {
- var ix = who._x + 90;
- }
- else
- {
- var ix = who._x - 90;
- }
- }
- else
- {
- var ix = who._x;
- }
- iy = who._y - 40;
- if(!b.predead)
- {
- i = 0;
- while(i < 4)
- {
- j = wrap.attachMovie("bits" + i,"bit" + i,starcv);
- starcv++;
- j._x = ix + (random(20) - 10);
- j._y = iy - (random(20) - 10);
- j.xvel = random(20) - 10;
- j.yvel = random(20) * -1;
- j.onEnterFrame = function()
- {
- this._x += this.xvel;
- this._y += this.yvel;
- this.xvel *= 0.9;
- this.yvel += grav;
- if(this._y > 500)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- };
- i++;
- }
- }
- var num = ncv - 1;
- var turd = eval("wrap.pcount" + num);
- if(cl)
- {
- var mult = Math.round(amt);
- }
- else
- {
- var mult = 0;
- }
- wrap.bad.pax += mult;
- if(turd._x == undefined)
- {
- s = wrap.attachMovie("ptcounter","pcount" + ncv,8888888 + ncv);
- s._x = ix;
- s._y = iy;
- s.pt = "+ " + wrap.bad.pax;
- s.prev = wrap.bad.pax;
- s.cv = 0;
- s.onEnterFrame = function()
- {
- this._y -= 2;
- this.cv = this.cv + 1;
- if(this.cv >= 30)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- };
- ncv++;
- }
- else
- {
- turd.pt = "+ " + wrap.bad.pax;
- }
- this.score += wrap.bad.pax;
- }
- }
- }
- function runSpecial(x, y, id, dir)
- {
- flashIt();
- sp = wrap.attachMovie("special" + id,"special",999);
- sp._x = x;
- sp._y = y;
- sp._xscale = 100 * dir;
- sp.dir = dir;
- sp.onEnterFrame = function()
- {
- this._x += dir * 3;
- };
- }
- function hitRecover(who)
- {
- if(!who.attacking)
- {
- who.guts.gotoAndStop("rest");
- }
- }
- function jumpRecover(who)
- {
- who.jumping = false;
- if(!who.attacking)
- {
- who.guts.gotoAndStop("rest");
- }
- }
- function runJump(who)
- {
- who.yvel = -23;
- who.jlo = false;
- if(!who.attacking)
- {
- who.guts.gotoAndStop("inair");
- }
- }
- function momentum(who, amt)
- {
- if(who._xscale == 100)
- {
- who.xvel += amt;
- }
- else
- {
- who.xvel -= amt;
- }
- }
- function endAttack(who)
- {
- who.attacking = false;
- who.guts.gotoAndStop("rest");
- who.jlo = false;
- if(who.jumping)
- {
- who.guts.gotoAndStop("inair");
- }
- if(Key.isDown(65) && who.aup)
- {
- who.attacking = true;
- who.aup = false;
- if(who.jumping)
- {
- who.anum = 1;
- }
- who.guts.gotoAndStop("attack" + who.anum);
- who.anum += 1;
- if(who.anum == 3)
- {
- who.anum = 0;
- }
- var sou = eval("swin" + who.anum);
- sou.start();
- }
- }
- function centerOn(who)
- {
- goalx = 320 - who._x;
- distx = goalx - wrap._x;
- wrap._x += distx / 4;
- }
- function restrainBG()
- {
- if(wrap._x > -25)
- {
- wrap._x = -25;
- }
- var _loc1_ = - screenw + 650;
- if(wrap._x < _loc1_)
- {
- wrap._x = _loc1_;
- }
- }
- function restrainDude(who)
- {
- if(who._x < 70)
- {
- who._x = 70;
- who.xvel = 0;
- }
- if(who._x > wrap.bg._width - 60)
- {
- who._x = wrap.bg._width - 60;
- who.xvel = 0;
- }
- if(who._y < 60)
- {
- who._y = 60;
- }
- }
- function endBossAttack(who)
- {
- who.attacking = false;
- who.guts.gotoAndStop("rest");
- who.inv = false;
- who.overr = false;
- }
- function runEndEffects()
- {
- d.dead = true;
- }
- function checkBossHit(box, fire, flame)
- {
- if(!summoning)
- {
- i = 0;
- while(i < stones.length)
- {
- var yi = stones[i];
- if(box.hitTest(yi) && !yi.hurt)
- {
- hit2.start();
- r = wrap.attachMovie("hitpoof","poof" + starcv,starcv + 999999);
- starcv++;
- r._xscale = 70;
- r._x = yi._x;
- r._y = yi._y - 30;
- if(b._x > r._x)
- {
- r._xscale = -70;
- }
- else
- {
- r._xscale = 70;
- }
- r._yscale = r._xscale;
- yi.yvel = -20;
- yi.hurt = true;
- if(yi._x > b._x)
- {
- yi.xvel += 10;
- yi._xscale = -100;
- }
- else
- {
- yi.xvel -= 10;
- yi._xscale = 100;
- }
- }
- i++;
- }
- if(box.hitTest(d.guts.box) && !d.hurt && !d.dead && !d.blinking)
- {
- d.inv = true;
- var ra = random(3);
- var plain = eval("hit" + ra);
- plain.start();
- flashIt();
- d.hurt = true;
- if(!fire)
- {
- d.guts.gotoAndStop("airhit");
- d.yvel = -20;
- }
- if(fire)
- {
- d.guts.gotoAndStop("burned");
- d.yvel = -20;
- }
- if(flame)
- {
- d.guts.gotoAndStop("burn");
- d.yvel = -20;
- }
- d.life -= 20;
- if(!nox)
- {
- if(d._x > b._x)
- {
- d.xvel = 30;
- d._xscale = -100;
- }
- else
- {
- d.xvel = -30;
- d._xscale = 100;
- }
- if(b._xscale == -100)
- {
- d.xvel = -35;
- d._xscale = 100;
- }
- }
- d.attacking = false;
- d.jlo = false;
- if(d.life <= 0)
- {
- d.life = 0;
- runEndEffects();
- }
- }
- }
- }
- function makeInv()
- {
- b.inv = true;
- }
- function bossMove()
- {
- if(b.ploy == 1)
- {
- if(!b.doneit)
- {
- b.pattern = 2;
- b.doneit = true;
- }
- else if(!b.dunn)
- {
- b.pattern = 4;
- if(!b.laffed)
- {
- laugh.start();
- b.laffed = true;
- }
- else
- {
- b.laffed = false;
- nochance.start();
- }
- b.dunn = true;
- }
- else
- {
- b.pattern = 4;
- }
- b.aicv = 0;
- b._xscale = 100;
- }
- if(b.ploy == 0)
- {
- b.ploy = 1;
- }
- }
- function switchBoss()
- {
- flashIt();
- bgmusic.stop();
- if(!this.mute)
- {
- bgmusic2.start(0,999);
- }
- this.bgmuse2 = true;
- kl = wrap.attachMovie("bigsplode","sploder",569648999);
- kl._x = b._x;
- kl._y = b._y;
- b.nohit = true;
- b.guts.gotoAndStop("skull");
- b.skullit = true;
- }
- function skullChange()
- {
- b.guts.gotoAndStop("skull");
- }
- function makeFireballzRight()
- {
- fireballsound.start();
- fireballsound.start();
- flashIt();
- f = wrap.attachMovie("fireball","mball" + starcv,starcv);
- starcv++;
- f._x = b._x + 20;
- f._y = b._y + 45;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- this._x += 10;
- checkBossHit(this.box,false,true);
- if(this._x > 2800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","mball" + starcv,starcv);
- starcv++;
- f._x = b._x - 20;
- f._y = b._y + 45;
- f._xscale = -100;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- this._x -= 10;
- checkBossHit(this.box,false,true);
- if(this._x > 2800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","fball" + starcv,starcv);
- starcv++;
- f._x = b._x + 20;
- f._y = b._y + 25;
- f._rotation = -45;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- checkBossHit(this.box,false,true);
- this._x += 10;
- this._y -= 10;
- if(this._x > 2800 || this._x < 0)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","fball" + starcv,starcv);
- starcv++;
- f._x = b._x - 20;
- f._y = b._y + 25;
- f._rotation = 45;
- f._xscale = -100;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- checkBossHit(this.box,false,true);
- this._x -= 10;
- this._y -= 10;
- if(this._x > 2800 || this._x < 0)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","fball" + starcv,starcv);
- starcv++;
- f._x = b._x + 20;
- f._y = b._y + 65;
- f._rotation = 45;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- checkBossHit(this.box,false,true);
- this._x += 10;
- this._y += 10;
- if(this._x > 2800 || this._x < 0)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","fball" + starcv,starcv);
- starcv++;
- f._x = b._x - 20;
- f._y = b._y + 65;
- f._rotation = -45;
- f._xscale = -100;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- checkBossHit(this.box,false,true);
- this._x -= 10;
- this._y += 10;
- if(this._x > 2800 || this._x < 0)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- f = wrap.attachMovie("fireball","fball" + starcv,starcv);
- starcv++;
- f._x = b._x;
- f._y = b._y + 65;
- f._rotation = 90;
- f._xscale = 100;
- f.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- checkBossHit(this.box,false,true);
- this._y += 10;
- if(this._y > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- if(this._y < -300)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- }
- function winIt()
- {
- if(!d.jumping)
- {
- d.guts.gotoAndStop("rest");
- }
- go = this.attachMovie("winscreen","winner",998799);
- go.aup = false;
- pausy = true;
- won = true;
- }
- function winPresses()
- {
- go = this.winner;
- go.onEnterFrame = function()
- {
- if(!Key.isDown(65))
- {
- this.aup = true;
- }
- if(Key.isDown(65) && this.aup)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- delete this.onPress;
- _root.gotoAndStop(2);
- }
- };
- }
- function ai()
- {
- if(!b.finaldead)
- {
- if(wrap.flasher._currentframe != 1 && !pausy)
- {
- wrap.flasher.play();
- }
- if(b.life <= 0 && !b.predead)
- {
- b.home = b._x;
- b.predead = true;
- b.inv = true;
- b.tranny = true;
- b.guts.gotoAndStop("die0");
- }
- if(b.life < 0 && b.predead && !b.tranny)
- {
- stopAllSounds();
- b.guts.gotoAndStop("die1");
- death.start();
- b.finaldead = true;
- }
- if(b.predead && b.inv && !b.skullit)
- {
- if(b.rig)
- {
- b.rig = false;
- b._x = b.home + 5;
- }
- else
- {
- b.rig = true;
- b._x = b.home - 5;
- }
- }
- if(b.skullit)
- {
- if(b.life < 60)
- {
- b.maxlife = 60;
- b.life += 2;
- }
- else if(!b.boogah)
- {
- b.tranny = false;
- b.inv = false;
- b.endbattle = true;
- b.boogah = true;
- b.skullit = false;
- b.aicv = 0;
- }
- }
- if(b.endbattle)
- {
- b.chasex = false;
- b.chasey = false;
- if(!b.goright && !b.gocenter || b.goleft)
- {
- goalx = 190;
- goaly = 200;
- b.goleft = true;
- }
- if(b.goright)
- {
- goalx = 1220;
- goaly = 200;
- }
- if(b.gocenter)
- {
- goalx = 600;
- goaly = 100;
- }
- distx = goalx - b._x;
- disty = goaly - b._y;
- b.xvel += distx / 105;
- b.yvel += disty / 105;
- tax = Math.abs(distx);
- tay = Math.abs(disty);
- if(tax < 70 && tay < 70)
- {
- b.aicv = b.aicv + 1;
- if(b.aicv > 15 && !b.finaldead)
- {
- b.guts.gotoAndStop("fireballz");
- }
- if(b.aicv >= 30 && !b.finaldead)
- {
- b.endbattle = false;
- b.waiting = true;
- b.aicv = 0;
- if(b._x < 400)
- {
- makeFireballzRight();
- }
- if(b._x > 400 && b._x < 1000)
- {
- makeFireballzRight();
- }
- if(b._x > 1000)
- {
- makeFireballzRight();
- }
- }
- }
- }
- if(b.waiting)
- {
- b.aicv = b.aicv + 1;
- if(b.aicv > 50)
- {
- b.waiting = false;
- b.endbattle = true;
- b.inv = false;
- if(b.goright)
- {
- b.goleft = false;
- b.gocenter = true;
- b.goright = false;
- return undefined;
- }
- if(b.goleft)
- {
- b.goleft = false;
- b.gocenter = false;
- b.goright = true;
- return undefined;
- }
- if(b.gocenter)
- {
- b.goleft = true;
- b.gocenter = false;
- b.goright = false;
- return undefined;
- }
- }
- }
- if(!b.predead)
- {
- if(b.pattern == 6)
- {
- b.aicv = b.aicv + 1;
- if(b.aicv >= 70)
- {
- b.doneit = false;
- b.dunn = false;
- b.pattern = 0;
- b.aicv = 0;
- }
- }
- if(b.pattern == 5)
- {
- h = wrap.attachMovie("hairball0","ball1",889987666);
- h.box.heavy = true;
- h._x = 200 + (random(200) - 100);
- h._y = -100;
- h.yvel = 0;
- h.hitit = false;
- h.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- if(!this.gothim)
- {
- _root.checkBossHit(this.box);
- }
- if(this.box.hitTest(d.guts.box))
- {
- this.gothim = true;
- }
- this._y += this.yvel;
- this.yvel += grav * 0.7;
- this.virtx = this._x + wrap._x;
- this.virty = this._y + wrap._y;
- if(!this.hitit)
- {
- while(wrap.bg.hitTest(this.virtx,this.virty,true))
- {
- this._y -= 1;
- this.virty -= 1;
- this.yvel = -10;
- this.hitit = true;
- }
- if(this.hitit)
- {
- groundhit.start();
- }
- }
- if(this.virty > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- h = wrap.attachMovie("hairball0","ball0",889987665);
- h.box.heavy = true;
- h._x = 400 + (random(200) - 100);
- h._y = -150;
- h.yvel = 0;
- h.hitit = false;
- h.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- if(!this.gothim)
- {
- _root.checkBossHit(this.box);
- }
- if(this.box.hitTest(d.guts.box))
- {
- this.gothim = true;
- }
- this._y += this.yvel;
- this.yvel += grav * 0.7;
- this.virtx = this._x + wrap._x;
- this.virty = this._y + wrap._y;
- if(!this.hitit)
- {
- while(wrap.bg.hitTest(this.virtx,this.virty,true))
- {
- this._y -= 1;
- this.virty -= 1;
- this.yvel = -10;
- this.hitit = true;
- }
- if(this.hitit)
- {
- groundhit.start();
- }
- }
- if(this.virty > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- h = wrap.attachMovie("hairball0","ball3",889987667);
- h.box.heavy = true;
- h._x = 650 + (random(200) - 100);
- h._y = -190;
- h.yvel = 0;
- h.hitit = false;
- h.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- if(!this.gothim)
- {
- _root.checkBossHit(this.box);
- }
- if(this.box.hitTest(d.guts.box))
- {
- this.gothim = true;
- }
- this._y += this.yvel;
- this.yvel += grav * 0.7;
- this.virtx = this._x + wrap._x;
- this.virty = this._y + wrap._y;
- if(!this.hitit)
- {
- while(wrap.bg.hitTest(this.virtx,this.virty,true))
- {
- this._y -= 1;
- this.virty -= 1;
- this.yvel = -10;
- this.hitit = true;
- }
- if(this.hitit)
- {
- groundhit.start();
- }
- }
- if(this.virty > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- h = wrap.attachMovie("hairball0","ball4",889987669);
- h.box.heavy = true;
- h._x = 1000 + (random(200) - 100);
- h._y = -100;
- h.yvel = 0;
- h.hitit = false;
- h.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- if(!this.gothim)
- {
- _root.checkBossHit(this.box);
- }
- if(this.box.hitTest(d.guts.box))
- {
- this.gothim = true;
- }
- this._y += this.yvel;
- this.yvel += grav * 0.7;
- this.virtx = this._x + wrap._x;
- this.virty = this._y + wrap._y;
- if(!this.hitit)
- {
- while(wrap.bg.hitTest(this.virtx,this.virty,true))
- {
- this._y -= 1;
- this.virty -= 1;
- this.yvel = -10;
- this.hitit = true;
- }
- if(this.hitit)
- {
- groundhit.start();
- }
- }
- if(this.virty > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- h = wrap.attachMovie("hairball0","ball5",889987670);
- h.box.heavy = true;
- h._x = 1290 + (random(200) - 100);
- h._y = -150;
- h.yvel = 0;
- h.hitit = false;
- h.onEnterFrame = function()
- {
- if(!_root.pausy)
- {
- if(!this.gothim)
- {
- _root.checkBossHit(this.box);
- }
- if(this.box.hitTest(d.guts.box))
- {
- this.gothim = true;
- }
- this._y += this.yvel;
- this.yvel += grav * 0.7;
- this.virtx = this._x + wrap._x;
- this.virty = this._y + wrap._y;
- if(!this.hitit)
- {
- while(wrap.bg.hitTest(this.virtx,this.virty,true))
- {
- this._y -= 1;
- this.virty -= 1;
- this.yvel = -10;
- this.hitit = true;
- }
- if(this.hitit)
- {
- groundhit.start();
- }
- }
- if(this.virty > 800)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- }
- }
- };
- b.aicv = 0;
- b.pattern = 6;
- }
- if(b.pattern == 4)
- {
- b.above = true;
- goalx = 660;
- goaly = -300;
- distx = goalx - b._x;
- disty = goaly - b._y;
- b.xvel += distx / 75;
- b.yvel += disty / 295;
- tay = Math.abs(disty);
- if(tay < 80)
- {
- b.pattern = 5;
- b.aicv = 0;
- }
- }
- if(b.pattern == 1)
- {
- b.chasex = false;
- b.chasey = false;
- if(b.side == 0)
- {
- if(b.ploy == 0)
- {
- goalx = 150;
- goaly = 150;
- }
- if(b.ploy == 1)
- {
- goalx = 150;
- goaly = 400;
- }
- }
- if(b.side == 1)
- {
- if(b.ploy == 0)
- {
- goalx = 1300;
- goaly = 150;
- }
- if(b.ploy == 1)
- {
- goalx = 1300;
- goaly = 400;
- }
- }
- if(!b.attacking)
- {
- distx = goalx - b._x;
- disty = goaly - b._y;
- b.xvel += distx / 95;
- b.yvel += disty / 95;
- tax = Math.abs(distx);
- tay = Math.abs(disty);
- if(tax < 90 && tay < 90)
- {
- b.attacking = true;
- b.guts.gotoAndStop("attack2");
- if(b.side == 1)
- {
- b._xscale = -100;
- }
- }
- }
- }
- if(b.pattern == 0 || b.pattern == 2 || b.pattern == 3)
- {
- b.aicv = b.aicv + 1;
- if(b.aicv >= 230)
- {
- b.aicv = 0;
- b.chasex = false;
- b.chasey = false;
- b.ploy = 0;
- if(b.pattern == 0)
- {
- b.side = 0;
- }
- else if(b.side == 0)
- {
- b.side = 1;
- }
- else
- {
- b.side = 0;
- }
- b.pattern = 1;
- }
- b.distx = d._x - b._x;
- b.disty = d._y - (b._y + 150);
- b.dist = Math.sqrt(b.distx * b.distx + b.disty * b.disty);
- if(!d.hurt)
- {
- if(!b.attacking)
- {
- if(b.dist > 220)
- {
- b.chasex = true;
- b.chasey = true;
- }
- else
- {
- b.chasex = false;
- b.deccount += 1;
- if(b.deccount >= 50)
- {
- b.deccount = 0;
- b.attacking = true;
- var _loc5_ = Math.abs(b.distx);
- if(_loc5_ > 120 || b.disty > 70)
- {
- b.guts.gotoAndStop("attack0");
- }
- else
- {
- b.guts.gotoAndStop("attack1");
- b.overr = true;
- }
- }
- }
- }
- if(b.overr)
- {
- b.xvel += b.distx / 72;
- }
- }
- else
- {
- var _loc4_ = 650 - b._x;
- var _loc3_ = 80 - b._y;
- b.xvel += _loc4_ / 50;
- b.yvel += _loc3_ / 50;
- }
- }
- }
- }
- }
- function loseLife()
- {
- this.lives = this.lives - 1;
- if(this.lives > 0)
- {
- d.carrot = false;
- gs = this.wrap.attachMovie("gstone","gstone" + stones.length + 1,99555 + stones.length + 1);
- gs._x = d._x;
- gs._y = d._y;
- gs._xscale = d._xscale;
- gs.gotoAndStop(37);
- gs.xvel = 0;
- gs.yvel = 0;
- stones.push(gs);
- d.guts.gotoAndStop("rest");
- d.hurt = false;
- d.dead = false;
- d.stoned = false;
- d.xvel = 0;
- d.yvel = 0;
- d._x = 220;
- d._y = 120;
- d._xscale = 100;
- d.blinking = true;
- d.life = 100;
- d.powa = 0;
- d.attacking = false;
- d.jumping = false;
- d.jlo = false;
- d.charge = 0;
- d.blinkcv = 0;
- }
- else
- {
- stones.push(d);
- stopAllSounds();
- if(!this.grover)
- {
- nothing.start();
- this.grover = true;
- }
- go = this.attachMovie("gameover","gameover",99);
- go.aup = false;
- }
- }
- function showOver()
- {
- pausy = true;
- go = this.gameover;
- go.onPress = function()
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- delete this.onPress;
- _root.gotoAndStop(2);
- };
- go.onEnterFrame = function()
- {
- if(!Key.isDown(65))
- {
- this.aup = true;
- }
- if(Key.isDown(65) && this.aup)
- {
- this.unloadMovie();
- this.removeMovieClip();
- delete this.onEnterFrame;
- delete this.onPress;
- _root.gotoAndStop(2);
- }
- };
- }
- function gameOver()
- {
- trace("GAME OVER");
- }
- function aifuncs()
- {
- b._y += b.yvel;
- b.yvel *= 0.8;
- b.xvel *= 0.8;
- if(b.expirecv > 0)
- {
- b.expirecv -= 1;
- }
- var _loc3_ = b.guts.e0;
- var _loc2_ = b.guts.e1;
- if(b._xscale < 0)
- {
- mult = -1;
- }
- else
- {
- mult = 1;
- }
- _loc3_.distx = d._x - (b._x + b.guts._x + _loc3_._x);
- _loc3_.disty = d._y - (b._y + b.guts._y + _loc3_._y);
- _loc3_.rads = Math.atan2(_loc3_.disty,_loc3_.distx * mult);
- _loc3_._rotation = _loc3_.rads * 180 / 3.141592653589793;
- _loc2_.distx = d._x - (b._x + b.guts._x + _loc2_._x);
- _loc2_.disty = d._y - (b._y + b.guts._y + _loc2_._y);
- _loc2_.rads = Math.atan2(_loc2_.disty,_loc2_.distx * mult);
- _loc2_._rotation = _loc2_.rads * 180 / 3.141592653589793;
- if(b.chasex)
- {
- var _loc7_ = d._x - b._x;
- b.xvel += _loc7_ / 155;
- }
- var _loc5_ = b._x + b.xvel;
- if(b.chasey)
- {
- var _loc6_ = d._y - (b._y + 150);
- b.yvel += _loc6_ / 155;
- }
- if(b._y < 100 && !b.above)
- {
- b._y = 100;
- }
- var _loc4_ = _loc5_ - b._x;
- b._x = _loc5_;
- i = 0;
- while(i < stones.length)
- {
- var _loc1_ = stones[i];
- if(p.hitTest(_loc1_))
- {
- _loc1_._x += _loc4_;
- }
- i++;
- }
- if(p.hitTest(d))
- {
- d._x += _loc4_;
- }
- p._x = b._x - 320;
- p._y = b._y - 20;
- }
- function stonePhys()
- {
- i = 0;
- while(i < stones.length)
- {
- var _loc1_ = stones[i];
- _loc1_.virtx = wrap._x + _loc1_._x;
- _loc1_.virty = wrap._y + _loc1_._y;
- _loc1_._y += _loc1_.yvel;
- _loc1_._x += _loc1_.xvel;
- var _loc2_ = Math.abs(_loc1_.xvel);
- if(_loc2_ < 1)
- {
- _loc1_.xvel = 0;
- }
- _loc1_.xvel *= 0.8;
- _loc1_.yvel += grav;
- _loc1_.virty += _loc1_.yvel;
- _loc1_.topp = _loc1_.virty - _loc1_._height;
- while(wrap.bg.hitTest(_loc1_.virtx,_loc1_.topp,true))
- {
- _loc1_._y += 1;
- _loc1_.virty += 1;
- _loc1_.topp += 1;
- _loc1_.yvel = 5;
- }
- while(wrap.bg.hitTest(_loc1_.virtx,_loc1_.virty,true))
- {
- _loc1_._y -= 1;
- _loc1_.virty -= 1;
- _loc1_.yvel = 0;
- _loc1_.inair = false;
- _loc1_.juggle = 0;
- _loc1_.hurt = false;
- }
- i++;
- }
- }
- JUMPBUT = 38;
- this.mute = false;
- this.bgmuse2 = false;
- this.pdiddy._visible = false;
- this.pausy = false;
- this.summoning = false;
- this.grover = false;
- wrap.bg.plat.unloadMovie();
- wrap.bg.plat.removeMovieClip();
- slowmult = 1;
- this.lives = 3;
- grav = 2;
- fric = 0.75;
- this.ncv = 0;
- screenw = wrap.bg._width - 50;
- this.score = 0;
- this.lev = 0;
- this.levreqs = new Array(100,250,650,950);
- this.nex = levreqs[0];
- this.starcv = 0;
- hud.holder.guts.attachMovie("levicon" + this.lev,"guts",0);
- stones = new Array();
- i = 0;
- while(i < 4)
- {
- gs = this.wrap.attachMovie("gstone","gstone" + i,99555 + i);
- gs._x = random(1250) + 70;
- while(!wrap.bg.hitTest(gs._x,gs._y,true) || gs.hitTest(wrap.bg.plat))
- {
- gs._y += 1;
- }
- var sc = random(2);
- if(sc == 0)
- {
- gs._xscale = 100;
- }
- else
- {
- gs._xscale = -100;
- }
- gs.gotoAndStop(37);
- gs.xvel = 0;
- gs.yvel = 0;
- stones.push(gs);
- i++;
- }
- d = wrap.dude;
- d.invcv = 0;
- d.blinkcv = 0;
- d.blinking = true;
- d.anum = 0;
- d.regen = 0.1;
- d.charge = 0;
- d.chargelim = 20;
- dudes = new Array(3,1,2,0,4);
- d.attachMovie("k" + dudes[this.lev],"guts",0);
- d.id = dudes[this.lev];
- d.speed = 4;
- d.life = 100;
- d.maxlife = 100;
- d.powa = 0;
- d.xvel = 0;
- d.yvel = 0;
- d.hurtcv = 0;
- b = wrap.bad;
- b.life = 130;
- b.maxlife = b.life;
- b.maxexpire = 20;
- b.xvel = 0;
- b.yvel = 0;
- b.deccount = 0;
- b.pattern = 0;
- b.aicv = 0;
- b.inv = false;
- b.finaldead = false;
- b.predead = false;
- b.pattern = 0;
- b.dunn = false;
- b.aicv = 0;
- b.skullit = false;
- b.home = undefined;
- b.boogah = false;
- b.endbattle = false;
- b.chasex = false;
- b.chasey = false;
- b.gocenter = false;
- b.goleft = true;
- b.goright = false;
- b.waiting = false;
- b.above = false;
- b.side = 0;
- b.attacking = false;
- b.overr = false;
- b.nohit = false;
- won = false;
- p = wrap.bg.plat;
- updateHUD();
- eyesc = b.guts.e0._xscale;
- this.onEnterFrame = function()
- {
- if(!this.pausy)
- {
- ai();
- aifuncs();
- if(!d.hurt && !d.dead)
- {
- controls(d);
- }
- phys(d);
- stonePhys();
- if(!b.finaldead)
- {
- centerOn(d);
- }
- else
- {
- centerOn(b);
- }
- restrainBG();
- restrainDude(d);
- }
- if(!Key.isDown(77))
- {
- this.mib = true;
- }
- if(Key.isDown(77) && this.mib)
- {
- this.mib = false;
- if(!this.mute)
- {
- this.mute = true;
- if(this.bgmuse2)
- {
- bgmusic2.stop();
- }
- else
- {
- bgmusic.stop();
- }
- }
- else
- {
- this.mute = false;
- if(this.bgmuse2)
- {
- bgmusic2.start(0,999);
- }
- else
- {
- bgmusic.start(0,999);
- }
- }
- }
- if(!Key.isDown(80))
- {
- this.pawup = true;
- }
- if(Key.isDown(80) && this.pawup && !d.dead && !won && this.gameover._x == undefined)
- {
- if(this.paws)
- {
- this.pdiddy._visible = false;
- this.paws = false;
- this.pausy = false;
- pausesound.start();
- b.guts.innards.play();
- }
- else if(!this.pausy)
- {
- pausesound.start();
- this.pdiddy._visible = true;
- this.paws = true;
- this.pausy = true;
- b.guts.innards.stop();
- wrap.flasher.stop();
- d.attacking = false;
- if(!d.jumping)
- {
- d.guts.gotoAndStop("rest");
- }
- }
- this.pawup = false;
- }
- if(!Key.isDown(82))
- {
- this.rup = true;
- }
- if(Key.isDown(82) && this.rup && !won && this.gameover._x == undefined)
- {
- lup.unloadMovie();
- lup.removeMovieClip();
- _root.gotoAndStop(2);
- }
- };
-