home *** CD-ROM | disk | FTP | other *** search
- class PlayerSpeedHandler
- {
- var speed;
- var playerFramerate;
- var boostState;
- var boostPower;
- var BOOSTCONST;
- var boostLock;
- var boostJauge;
- var timer;
- var mcBoostJauge;
- var mcTrainee;
- function PlayerSpeedHandler(mcBoostJauge, mcTrainee)
- {
- this.speed = 3.5;
- this.playerFramerate = 40;
- this.boostState = false;
- this.boostPower = 1;
- this.BOOSTCONST = 2;
- this.boostLock = false;
- this.boostJauge = 100;
- this.timer = new TimerSynchronizer();
- this.mcBoostJauge = mcBoostJauge;
- this.mcTrainee = mcTrainee;
- }
- function setSpeed(speed)
- {
- this.speed = speed;
- }
- function setBoostState(bool)
- {
- this.boostState = bool;
- }
- function setBoostPower(coef)
- {
- this.boostPower = coef;
- }
- function setBoostLock(bool)
- {
- this.boostLock = bool;
- }
- function setBoostJauge(capacity)
- {
- this.boostJauge = capacity;
- }
- function getSpeed()
- {
- return this.speed;
- }
- function getBoostState()
- {
- return this.boostState;
- }
- function getBoostPower()
- {
- return this.boostPower;
- }
- function getBoostLock()
- {
- return this.boostLock;
- }
- function getBoostJauge()
- {
- return this.boostJauge;
- }
- function getBOOSTCONST()
- {
- return this.BOOSTCONST;
- }
- function getPlayerFramerate()
- {
- return this.playerFramerate;
- }
- function boostActivation()
- {
- this.boostPower = this.BOOSTCONST;
- this.boostState = true;
- }
- function boostDesactivation()
- {
- this.boostPower = 1;
- this.boostState = false;
- }
- function boostAnalyser()
- {
- var _loc2_ = this.timer.getElapsedTimeMs();
- if(this.boostJauge <= 5)
- {
- this.boostDesactivation();
- this.mcBoostJauge._visible = false;
- this.mcTrainee._visible = false;
- }
- if(this.boostJauge > 6)
- {
- this.mcBoostJauge._visible = true;
- }
- if(_loc2_ >= 10)
- {
- if(this.boostState == false)
- {
- if(this.boostJauge < 100)
- {
- this.mcTrainee._visible = false;
- this.boostJauge += 1;
- this.mcBoostJauge._xscale = this.boostJauge;
- this.playerFramerate = 40;
- }
- }
- if(this.boostState == true && this.boostLock == false)
- {
- if(this.boostJauge >= 0)
- {
- if(this.boostJauge > 6)
- {
- this.mcTrainee._visible = true;
- }
- this.boostJauge -= 5;
- this.mcBoostJauge._xscale = this.boostJauge;
- this.playerFramerate = 20;
- }
- }
- this.timer.setOldTimer(getTimer());
- }
- }
- }
-