home *** CD-ROM | disk | FTP | other *** search
- function cBall(lsClip)
- {
- this.piGravity = 1;
- _root.action_layer.attachMovie(lsClip,"ball",1);
- this.pmClip = _root.action_layer.ball;
- this.poVelocity = new Object();
- this.mHide();
- }
- cBall.prototype.mFire = function(liAngle, liPower)
- {
- this.pbHidden = false;
- this.pmClip._x = 93 + Math.cosD(liAngle) * 35;
- this.pmClip._y = 309 + Math.sinD(liAngle) * 35;
- this.pmClip._y = pt.y;
- this.poVelocity._x = Math.cosD(liAngle) * liPower;
- this.poVelocity._y = Math.sinD(liAngle) * liPower;
- };
- cBall.prototype.mReFire = function(liAngle, liPower, lpLoc)
- {
- this.pbHidden = false;
- var liX = this.pmClip._x;
- var liY = this.pmClip._y;
- if(lpLoc != undefined)
- {
- liX = lpLoc.x - _root.action_layer._x;
- liY = lpLoc.y - _root.action_layer._y;
- }
- this.pmClip._x = liX + Math.cosD(liAngle) * 35;
- this.pmClip._y = liY + Math.sinD(liAngle) * 35;
- this.pmClip._y = pt.y;
- this.poVelocity._x = Math.cosD(liAngle) * liPower;
- this.poVelocity._y = Math.sinD(liAngle) * liPower;
- _root.goGame.mPlaySound("cannon");
- };
- cBall.prototype.mBounce = function(liAngle, liPower)
- {
- this.pbHidden = false;
- this.pmClip._x += Math.cosD(liAngle) * 35;
- this.pmClip._y += Math.sinD(liAngle) * 35;
- this.pmClip._y = pt.y;
- this.poVelocity._x = Math.cosD(liAngle) * liPower;
- this.poVelocity._y = Math.sinD(liAngle) * liPower;
- };
- cBall.prototype.mUpdate = function()
- {
- if(!this.pbHidden)
- {
- this.mCollide();
- this.pmClip._x += this.poVelocity._x;
- this.pmClip._y += this.poVelocity._y;
- this.poVelocity._y += this.piGravity;
- if(_root.goGame.pbRedBallActive != true)
- {
- if(400 < this.pmClip._x)
- {
- _root.action_layer._x = - (this.pmClip._x - 400);
- }
- if(this.pmClip._y < 40)
- {
- _root.action_layer._y = - (this.pmClip._y - 40);
- }
- }
- }
- };
- cBall.prototype.mCollide = function()
- {
- if(!this.pbCollide)
- {
- if(360 < this.pmClip._y + this.poVelocity._y)
- {
- _root.goGame.mSplash();
- }
- if(this.pmClip.hitTest(_root.thing))
- {
- this.poVelocity._y *= -0.7;
- }
- }
- };
- cBall.prototype.mBreak = function()
- {
- this.pbCollide = true;
- this.poVelocity._x = 0;
- this.poVelocity._y = 0;
- this.pmClip.gotoAndPlay("break");
- };
- cBall.prototype.mHide = function()
- {
- _root.action_layer.level_clip.level.pbCollide = false;
- this.pbHidden = true;
- this.poVelocity._x = 0;
- this.poVelocity._y = 0;
- this.pmClip._x = -400;
- this.pmClip._y = 1000;
- this.pbCollide = false;
- };
- cBall.prototype.mBounceX = function()
- {
- _root.goGame.mPlaySound("THUNK");
- this.poVelocity._x *= -0.7;
- };
- cBall.prototype.mBounceY = function()
- {
- _root.goGame.mPlaySound("THUNK");
- this.poVelocity._y *= -0.7;
- };
- cBall.prototype.mBounceYUp = function()
- {
- _root.goGame.mPlaySound("THUNK");
- if(0 < this.poVelocity._y)
- {
- this.poVelocity._y *= -0.7;
- }
- else
- {
- this.poVelocity._y *= 0.7;
- }
- };
- cBall.prototype.mBounceXY = function()
- {
- this.mBounceX();
- this.mBounceY();
- };
-