home *** CD-ROM | disk | FTP | other *** search
- this.grav = 2;
- this.dude.Yvel = 0;
- this.dude.Xvel = 0;
- this.bubcount = 0;
- this.opencount = 0;
- this.dude.chargecount = 0;
- this.vegcount = 500;
- this.vegarray = new Array();
- this.allarray = new Array();
- this.dude.blink = false;
- this.dude.blinkcount = 0;
- this.dude.floatcount = 0;
- this.hitcount = 0;
- tim0 = 5370;
- this.hp = 2;
- this.createEmptyMovieClip("bubs",100);
- d = this.dude.attachMovie("bomtoons_dude" + this.whichdude,"guts",0);
- d._xscale = 90;
- d._yscale = d._xscale;
- if(this.whichdude == 0)
- {
- this.speed = 2.2;
- this.maxjump = 13.8;
- this.friction = 0.8;
- }
- if(this.whichdude == 1)
- {
- this.speed = 2.1;
- this.maxjump = 12;
- this.friction = 0.89;
- }
- if(this.whichdude == 2)
- {
- this.speed = 2;
- this.maxjump = 15;
- this.friction = 0.75;
- }
- this.bubeffect = function(who)
- {
- this.bubs.bubeffect._x = who._x;
- this.bubs.bubeffect._y = who._y;
- };
- this.physics = function(who)
- {
- if(who.dead != true && this.won != true)
- {
- if(this.wart.guts.hitarea.hitTest(who) && who.blinking != true && who.inv != true)
- {
- this.hp -= 1;
- who.Xvel *= -1.5;
- who.Yvel = -10;
- who.blink = true;
- who.inv = true;
- }
- if(this.bg._y < -650)
- {
- this.life.gotoAndStop("empty");
- who.dead = true;
- }
- if(who.hitTest(this.bg2.as) && this.bg2.as._visible != false)
- {
- this.bg2.as._visible = false;
- this.bubs.attachMovie("bomtoons_bubeffect","bubeffect",555);
- f = this.bubs.attachMovie("as","as",430);
- f._x = who._x - this.bubs._x - 50;
- f._y = who._y - this.bubs._y;
- f.id = 999;
- f.onEnterFrame = function()
- {
- this._parent._parent.veggie(this);
- this._parent._parent.bubeffect(this);
- };
- }
- if(who.blink == true && who.beenshrunk != true)
- {
- who.blinkcount += 1;
- if(who.blinkcount < 5)
- {
- who._yscale -= (who._yscale - 50) / 3;
- who.shrinking = true;
- this.bg._y += 1;
- if(this.yorby != true)
- {
- this.shrink.start();
- this.yorby = true;
- }
- }
- else
- {
- who.blink = false;
- who.blinkcount = 0;
- who.shrinking = false;
- who.beenshrunk = true;
- who.inv = true;
- who.invcount = 0;
- this.yorby = false;
- }
- }
- if(who.inv == true)
- {
- who.invcount += 1;
- if(who._alpha < 100)
- {
- who._alpha = 100;
- }
- else
- {
- who._alpha = 0;
- }
- if(who.invcount > 90)
- {
- who.inv = false;
- who._alpha = 100;
- }
- }
- if(this.hp == 1)
- {
- this.life.gotoAndStop("half");
- if(who.shrinking == false)
- {
- if(who.beensmall != true)
- {
- who.attachMovie("bomtoons_dudesmall" + this.whichdude,"guts",0);
- who.beensmall = true;
- if(who._xscale > 0)
- {
- who._xscale = 100;
- }
- else
- {
- who._xscale = -100;
- }
- who._yscale = 100;
- }
- }
- }
- if(this.hp == 0)
- {
- this.life.gotoAndStop("empty");
- who.dead = true;
- }
- this.bg._y -= who.Yvel;
- this.bg._x -= who.Xvel;
- who.Xvel *= this.friction;
- who.nexty = who._y + who.Yvel * 1.8;
- who.midy = who._y - who._height / 2;
- who.topy = who._y - who._height + 15;
- who.edgex = who._x + who._width / 2 * (who._xscale / 100) + who.Xvel;
- if(this.bg.hitTest(who._x,who.nexty,true))
- {
- if(who.Yvel > 0)
- {
- who.Yvel -= who.Yvel;
- }
- if(who.jumping == true && !Key.isDown(38))
- {
- who.jumping = false;
- who.superjump = false;
- who.floatcount = 0;
- who.floatpressed = false;
- }
- }
- else if(this.whichdude != 2)
- {
- if(who.Yvel < 10)
- {
- who.Yvel += this.grav / 2;
- }
- }
- else
- {
- if(who.jumping == true)
- {
- if(Key.isDown(38) && who.Yvel > -1 && who.floatcount < 50)
- {
- who.floatpressed = true;
- who.Yvel = 0;
- who.floating = true;
- if(who.holding != true)
- {
- who.guts.gotoAndStop("jump");
- }
- else
- {
- who.guts.gotoAndStop("jumphold");
- }
- who.floatcount += 1;
- }
- if(!Key.isDown(38) || who.floatcount >= 50)
- {
- who.floating = false;
- if(who.floatpressed == true)
- {
- who.floatcount = 50;
- }
- }
- }
- if(who.Yvel < 10 && who.floating != true)
- {
- who.Yvel += this.grav / 2;
- }
- }
- if(this.bg.hitTest(who.edgex,who.topy,true) || this.bg.hitTest(who.edgex,who.nexty,true) and who.jumping == true)
- {
- var _loc4_ = Math.abs(who.Xvel);
- if(_loc4_ > 3.5)
- {
- who.Xvel *= -0.8;
- this.bg._x -= who.Xvel;
- }
- else if(who.superjump != true)
- {
- who.Xvel = 0;
- if(Key.isDown(37) || Key.isDown(39))
- {
- if(who._xscale > 0)
- {
- who.pushingright = true;
- }
- else
- {
- who.pushingleft = true;
- }
- }
- else
- {
- who.pushingleft = false;
- who.pushingright = false;
- }
- }
- }
- else
- {
- who.pushingleft = false;
- who.pushingright = false;
- }
- if(this.bg.hitTest(who._x,who.topy,true))
- {
- who.Yvel = Math.abs(who.Yvel) + 4;
- who.pushingleft = false;
- who.pushingright = false;
- }
- this.bg2._x = this.bg._x;
- this.bg2._y = this.bg._y;
- this.wart._x = this.bg._x;
- this.wart._y = this.bg._y;
- this.bubs._x = this.bg._x;
- this.bubs._y = this.bg._y;
- if(who.jumping == true)
- {
- if(who.Yvel < 0)
- {
- if(who.holding != true)
- {
- who.guts.gotoAndStop("jump");
- }
- else
- {
- who.guts.gotoAndStop("jumphold");
- }
- }
- else if(who.floating != true)
- {
- if(who.holding != true)
- {
- who.guts.gotoAndStop("run");
- }
- else
- {
- who.guts.gotoAndStop("runhold");
- }
- }
- }
- }
- if(who.dead == true)
- {
- if(this.killplayed != true)
- {
- stopAllSounds();
- this.lose.start();
- g = this.attachMovie("theend" + this.whichdude,"theend",879);
- g._x = who._x;
- g._y = who._y;
- g.Yvel = -25;
- this.nosound = true;
- g.onEnterFrame = function()
- {
- this._y += this.Yvel;
- this.Yvel += 1.5;
- if(this._y > 450)
- {
- trace("gameover");
- _root.lose();
- delete this.onEnterFrame;
- this.unloadMovie();
- this.removeMovieClip();
- }
- };
- this.killplayed = true;
- }
- delete who.onEnterFrame;
- who.unloadMovie();
- who.removeMovieClip();
- }
- };
- this.veggie = function(who)
- {
- if(who._y > Stage.height - this.bg._y && this.dude.jumping != true)
- {
- if(who.thrown == true)
- {
- this.vegarray = new Array();
- }
- if(who.id == 999)
- {
- this.bg2.as._visible = true;
- this.bubs.bubeffect.unloadMovie();
- this.bubs.bubeffect.removeMovieClip();
- }
- who.removeMovieClip();
- }
- if(this.dude.hitTest(who._x + this.bg._x,who._y + this.bg._y,true) && this.dude.holding != true && who.thrown != true)
- {
- who.grabbed = true;
- this.dude.holding = true;
- this.dude.storedheight = this.dude._height;
- }
- else if(who.grabbed != true)
- {
- who._x += who.Xvel;
- who._y += who.Yvel;
- who.Xvel *= 0.93;
- who.Yvel += 0.7;
- }
- if(who.grabbed == true)
- {
- if(this.dude.ducking == true)
- {
- who._y = this.dude._y - this.bg._y - 50;
- who._x = this.dude._x - this.bg._x + this.dude.Xvel;
- }
- else
- {
- who._x = this.dude._x - this.bg._x + this.dude.Xvel;
- who._y = this.dude._y - this.dude._height + 20 - this.bg._y;
- who._xscale = this.dude._xscale;
- if(this.dude.charged == true)
- {
- who._y = this.dude._y - this.dude.storedheight + 20 - this.bg._y + this.dude.Yvel;
- }
- }
- if(Key.isDown(32))
- {
- this.thro.start();
- this.vegarray.push("veg" + who.id);
- who.Xvel = this.dude.Xvel * 2;
- if(who.Xvel < 10 && who._xscale > 0)
- {
- who.Xvel = 10;
- }
- if(who.Xvel > -10 && who._xscale < 0)
- {
- who.Xvel = -10;
- }
- who._x += who.Xvel;
- who.Yvel = (Math.abs(this.dude.Xvel) + 2) * -0.5;
- this.dude.holding = false;
- who.thrown = true;
- who.grabbed = false;
- }
- if(this.dude.dead == true)
- {
- who.Yvel = this.grav;
- this.dude.holding = false;
- who.thrown = true;
- who.grabbed = false;
- }
- }
- };
- this.ai = function(who)
- {
- if(who._x < 1750 and who.goback != true && who.shooting != true)
- {
- who._x += 2;
- if(who._x >= 1750)
- {
- who.goback = true;
- }
- }
- if(who.goback == true && who.shooting != true)
- {
- if(who._x > 1600)
- {
- who._x -= 2;
- if(who._x <= 1600)
- {
- who.goback = false;
- }
- }
- }
- if(who.shooting == true)
- {
- if(this.bubcount == 1)
- {
- var _loc3_ = random(6);
- var _loc4_ = "bomtoons_veg" + _loc3_;
- v = this.bubs.attachMovie(_loc4_,"veg" + _loc3_,this.vegcount);
- v._x = 1260;
- v._y = 350;
- v.onEnterFrame = function()
- {
- this._parent._parent.veggie(this);
- };
- v.Xvel = -10;
- v.Yvel = -5;
- v.id = _loc3_;
- this.allarray[v.id] = "veg" + v.id;
- this.vegcount += 1;
- }
- if(this.bubcount < 12)
- {
- this.bubcount += 1;
- }
- else
- {
- this.opencount += 1;
- if(this.opencount > 25 && who.playhit != true)
- {
- who.shooting = false;
- this.bubcount = 0;
- this.opencount = 0;
- who.playhit = false;
- who.gotoAndStop("walk");
- }
- }
- if(this.bubcount < 12 && this.bubcount > 6)
- {
- who.gotoAndStop("shoot");
- b = this.bubs.attachMovie("bombub","bub" + this.bubcount,this.bubcount);
- b._x = who._parent._x + who._x - 35 - this.bg2._x;
- b._y = who._parent._y + who._y - 115 - this.bg2._y;
- b.Xvel = 120 / this.bubcount * -1 - random(this.bubcount * 2.5);
- b.Yvel = -15 - random(3);
- }
- }
- };
- this.shootbubbles = function(who)
- {
- if(who.shooting != true)
- {
- who.shooting = true;
- }
- };
- setInterval(this.shootbubbles,7000,this.wart.guts);
- this.onEnterFrame = function()
- {
- if(this.won != true && !this.dude.dead && !this.nosound)
- {
- if(tim0 > 0)
- {
- tim0 -= 1;
- }
- this.physics(this.dude);
- this.ai(this.wart.guts);
- if(Key.isDown(39) && !Key.isDown(40) && this.dude.pushingright != true)
- {
- if(!this.bg.hitTest(this.dude.edgex,this.dude.topy,true))
- {
- this.dude.Xvel += this.speed;
- }
- this.dude._xscale = 100;
- this.dude.charged = false;
- if(this.dude.jumping != true && this.dude.Yvel <= 0)
- {
- if(this.dude.holding != true)
- {
- this.dude.guts.gotoAndStop("run");
- }
- else
- {
- this.dude.guts.gotoAndStop("runhold");
- }
- }
- if(this.dude.Xvel < 0)
- {
- if(this.dude.holding != true)
- {
- this.dude.guts.gotoAndStop("slide");
- }
- else
- {
- this.dude.guts.gotoAndStop("holdslide");
- }
- }
- this.dude.pushingleft = false;
- }
- if(Key.isDown(37) && !Key.isDown(40) && this.dude.pushingleft != true)
- {
- if(!this.bg.hitTest(this.dude.edgex,this.dude.topy,true))
- {
- this.dude.Xvel -= this.speed;
- }
- this.dude._xscale = -100;
- this.dude.charged = false;
- if(this.dude.jumping != true && this.dude.Yvel <= 0)
- {
- if(this.dude.holding != true)
- {
- this.dude.guts.gotoAndStop("run");
- }
- else
- {
- this.dude.guts.gotoAndStop("runhold");
- }
- }
- if(this.dude.Xvel > 0)
- {
- if(this.dude.holding != true)
- {
- this.dude.guts.gotoAndStop("slide");
- }
- else
- {
- this.dude.guts.gotoAndStop("holdslide");
- }
- }
- this.dude.pushingright = false;
- }
- if(Key.isDown(38) && this.dude.jumping != true)
- {
- this.jump.start();
- if(this.dude.charged != true)
- {
- this.dude.Yvel -= this.maxjump + Math.abs(this.dude.Xvel) / 5;
- }
- else
- {
- if(this.whichdude == 0 || this.whichdude == 2)
- {
- this.dude.Yvel -= (this.maxjump + Math.abs(this.dude.Xvel) / 5) * 1.8;
- }
- if(this.whichdude == 1)
- {
- this.dude.Yvel -= (this.maxjump + Math.abs(this.dude.Xvel) / 5) * 2.1;
- }
- this.dude.superjump = true;
- this.dude.charged = false;
- }
- this.dude.jumping = true;
- }
- if(Key.isDown(40) && this.dude.jumping != true)
- {
- if(this.dude.charged != true)
- {
- this.dude.guts.gotoAndStop("duck");
- }
- else
- {
- this.dude.guts.gotoAndStop("duckcharge");
- }
- this.dude.ducking = true;
- this.dude.chargecount += 1;
- if(this.dude.chargecount > 25)
- {
- this.dude.charged = true;
- this.dude.pushingright = false;
- this.dude.pushingleft = false;
- }
- }
- else
- {
- this.dude.chargecount = 0;
- this.dude.ducking = false;
- }
- if(!Key.isDown(37) && !Key.isDown(39) && this.dude.jumping != true && !Key.isDown(40))
- {
- if(this.dude.holding != true)
- {
- if(this.dude.charged != true)
- {
- this.dude.guts.gotoAndStop("rest");
- }
- else
- {
- this.dude.guts.gotoAndStop("restcharge");
- }
- }
- else if(this.dude.charged != true)
- {
- this.dude.guts.gotoAndStop("resthold");
- }
- else
- {
- this.dude.guts.gotoAndStop("restholdcharge");
- }
- this.dude.pushingright = false;
- this.dude.pushingleft = false;
- this.dude.ducking = false;
- }
- if(!Key.isDown(40) and this.dude.charged != true)
- {
- this.dude.chargecount = 0;
- this.dude.ducking = false;
- }
- }
- else
- {
- this.dude.guts.gotoAndStop("rest");
- this.bubs.bubeffect.unloadMovie();
- }
- this.wartlife.gotoAndStop("l" + this.hitcount);
- };
-