home *** CD-ROM | disk | FTP | other *** search
- function cGame()
- {
- this.piLevel = 0;
- this.piMaxLevel = 15;
- this.piShotCount = 0;
- _root.giTotalShots = 0;
- _root.gems = 0;
- this.piAngle = 0;
- this.piPower = 0;
- this.piMaxPower = 15;
- this.pbActive = false;
- this.pbRedBallActive = false;
- this.poBall = new cBall("cannonball");
- this.paLevelStarts = [[],[-300,0],[-200,0],[-300,0],[-300,100],[-200,0],[0,0],[-200,0],[-250,0],[-300,0],[-340,0],[-300,0],[-200,0],[-100,0],[-390,0],[-200,0]];
- }
- cGame.prototype.mNextLevel = function()
- {
- this.piLevel = this.piLevel + 1;
- this.psLevel = "level" + this.piLevel;
- _root.map_clip.map.gotoAndPlay(this.psLevel);
- };
- cGame.prototype.mUpdateLevel = function()
- {
- this.mSetLevelStartPos();
- if(this.piLevel < 10)
- {
- var lsLevel = "0" + this.piLevel;
- }
- else
- {
- var lsLevel = "" + this.piLevel;
- }
- _root.gsLevel = lsLevel;
- this.piShotCount = 0;
- this.mUpdateShots();
- this.mUpdateBonus();
- this.mUpdateAngle();
- this.mUpdatePower();
- _root.action_layer.level_clip.gotoAndPlay(this.psLevel);
- };
- cGame.prototype.mSetLevelStartPos = function()
- {
- var laStart = this.paLevelStarts[this.piLevel];
- _root.action_layer._x = laStart[0];
- _root.action_layer._y = laStart[1];
- };
- cGame.prototype.mShowInstructions = function()
- {
- if(this.piMaxLevel >= this.piLevel)
- {
- _root.instructions_clip.gotoAndPlay(this.psLevel);
- }
- };
- cGame.prototype.mStartLevel = function()
- {
- this.pbGem = false;
- _root.action_layer.level_clip.level.mStart();
- this.mActivate();
- };
- cGame.prototype.mAdvanceEarly = function()
- {
- if(_root.gbTestMode)
- {
- this.mLevelComplete();
- }
- };
- cGame.prototype.mLevelComplete = function()
- {
- this.mPlaySound;
- this.mDeactivate();
- var liBonus = 10 - (this.piShotCount - 1);
- if(liBonus < 0)
- {
- liBonus = 0;
- }
- if(10 < liBonus)
- {
- liBonus = 10;
- }
- var lsBonus = "bonus" + liBonus;
- var liGemBonus = 1;
- if(this.pbGem == true)
- {
- liGemBonus = 2;
- }
- this.piScore += liBonus * 1000 * liGemBonus;
- this.mUpdateScore();
- this.piPower = 0;
- this.piAngle = 0;
- this.mUpdatePower();
- this.mUpdateAngle();
- _root.bonus_clip.gotoAndPlay(lsBonus);
- if(this.pbGem)
- {
- _root.bonus_clip.times2.gotoAndPlay(2);
- }
- };
- cGame.prototype.mUpdateScore = function()
- {
- var lsTemp = "" + this.piScore;
- var liZeroes = 6 - lsTemp.length;
- var lsScore = "";
- if(liZeroes < 0)
- {
- liZeroes = 0;
- }
- i = 0;
- while(i < liZeroes)
- {
- lsScore += "0";
- i++;
- }
- lsScore += this.piScore;
- _root.gScore = lsScore;
- };
- cGame.prototype.mActivate = function()
- {
- _root.controller_clip2.gotoAndPlay("on");
- _root.action_layer.sam_clip.cannon_clip.gotoAndPlay("on");
- _root.action_layer.pbReturn = true;
- _root.action_layer.level_clip.level.mReset();
- this.pbActive = true;
- };
- cGame.prototype.mDeactivate = function()
- {
- _root.controller_clip2.gotoAndPlay("off");
- _root.action_layer.sam_clip.cannon_clip.gotoAndPlay("off");
- this.pbActive = false;
- };
- cGame.prototype.mFire = function()
- {
- if(this.pbActive)
- {
- this.pbGreyBallActive = true;
- this.pbRedBallActive = false;
- this.mDeactivate();
- this.piShotCount = this.piShotCount + 1;
- _root.giTotalShots = _root.giTotalShots + 1;
- this.mUpdateShots();
- var liBonus = 10000 - (this.piShotCount - 1) * 1000;
- if(0 >= liBonus)
- {
- liBonus = 0;
- _root.gsBonus = "0000";
- }
- else
- {
- _root.gsBonus = "" + liBonus;
- }
- _root.action_layer.sam_clip.sam.play();
- _root.action_layer.sam_clip.cannon_clip.gotoAndPlay("fire");
- this.poBall.mFire(this.piAngle * -1,13 + this.piPower);
- }
- };
- cGame.prototype.mSplash = function()
- {
- _root.action_layer.splash_clip._x = this.poBall.pmClip._x;
- _root.action_layer.splash_clip.gotoAndPlay("splash");
- this.poBall.mHide();
- };
- cGame.prototype.mRedBallSplash = function(x)
- {
- _root.action_layer.splash2_clip._x = x + 400;
- _root.action_layer.splash2_clip.gotoAndPlay("splash");
- };
- cGame.prototype.mRedSplashResume = function()
- {
- this.pbRedBallActive = false;
- _root.action_layer.level_clip.redball.mReset();
- if(this.pbGreyBallActive == false)
- {
- this.mActivate();
- }
- };
- cGame.prototype.mSplashResume = function()
- {
- this.pbGreyBallActive = false;
- if(this.pbRedBallActive == false)
- {
- this.mActivate();
- }
- };
- cGame.prototype.mLessPower = function()
- {
- if(this.pbActive)
- {
- if(0 < this.piPower)
- {
- this.piPower--;
- this.mPlaySound("eyebrow");
- }
- this.mUpdatePower();
- }
- };
- cGame.prototype.mMorePower = function()
- {
- if(this.pbActive)
- {
- if(this.piPower < this.piMaxPower)
- {
- this.piPower = this.piPower + 1;
- this.mPlaySound("eyebrow");
- }
- this.mUpdatePower();
- }
- };
- cGame.prototype.mUpdatePower = function()
- {
- _root.interface_clip.power.gotoAndStop(this.piPower + 1);
- };
- cGame.prototype.mLessAngle = function()
- {
- if(this.pbActive)
- {
- if(0 < this.piAngle)
- {
- this.piAngle -= 5;
- this.mPlaySound("eyebrow");
- }
- this.mUpdateAngle();
- }
- };
- cGame.prototype.mMoreAngle = function()
- {
- if(this.pbActive)
- {
- if(this.piAngle < 90)
- {
- this.piAngle += 5;
- this.mPlaySound("eyebrow");
- }
- this.mUpdateAngle();
- }
- };
- cGame.prototype.mUpdateAngle = function()
- {
- _root.action_layer.sam_clip.cannon_clip._rotation = this.piAngle * -1;
- };
- cGame.prototype.mUpdateBonus = function()
- {
- var liIndex = 10 - this.piShotCount;
- if(liIndex < 0)
- {
- liIndex = 0;
- }
- var liBonus = 1000 * liIndex;
- _root.gsBonus = liBonus;
- };
- cGame.prototype.mUpdateShots = function()
- {
- if(this.piShotCount < 10)
- {
- var lsShots = "00" + this.piShotCount;
- }
- else if(this.piShotCount < 100)
- {
- var lsShots = "0" + this.piShotCount;
- }
- else
- {
- var lsShots = "" + this.piShotCount;
- }
- _root.gsShot = lsShots;
- };
- cGame.prototype.mPlaySound = function(lsSound)
- {
- loSound = new Sound();
- loSound.attachSound(lsSound);
- loSound.start();
- };
- cGame.prototype.mSoundOn = function()
- {
- _root.gbSound = true;
- _root.goSound = new Sound();
- _root.goSound.setVolume(_root.giOldVolume);
- };
- cGame.prototype.mSoundOff = function()
- {
- _root.gbSound = false;
- _root.goSound = new Sound();
- if(_root.giOldVolume == undefined)
- {
- _root.giOldVolume = _root.goSound.getVolume();
- }
- _root.goSound.setVolume(0);
- };
- cGame.prototype.mShowMiniHelp = function()
- {
- _root.minihelp.gotoAndPlay(2);
- };
- cGame.prototype.mHelpDone = function()
- {
- };
- cGame.prototype.mCollectCrystal = function()
- {
- _root.gems = _root.gems + 1;
- this.pbGem = true;
- };
-