home *** CD-ROM | disk | FTP | other *** search
- class Germ extends smashing.Renderable
- {
- var r = 15;
- var grabbable = true;
- var lowerLimit = 1.5;
- var variation = 1.5;
- var cNoise = 0;
- function Germ()
- {
- var _loc1_ = this;
- super();
- _loc1_.gotoAndStop(Math.ceil(Math.random() * _loc1_._totalframes));
- _loc1_.nNoise = _loc1_.getNoisePeriod();
- _loc1_.aNoise = ["germNoise0","germNoise1","germNoise2","germNoise3"];
- }
- function update(nElapsed)
- {
- var _loc1_ = this;
- _loc1_.cNoise += nElapsed;
- if(_loc1_.cNoise >= _loc1_.nNoise)
- {
- _loc1_.cNoise = 0;
- _loc1_.nNoise = _loc1_.getNoisePeriod();
- _global.oSound.playSnd(_loc1_.aNoise[Math.floor(Math.random() * _loc1_.aNoise.length)]);
- }
- _loc1_.render();
- }
- function render()
- {
- var _loc2_ = this;
- var _loc1_ = smashing.Viewport.getPos(_loc2_);
- _loc2_._x = _loc1_.x + smashing.Viewport.centerX;
- _loc2_._y = _loc1_.y + smashing.Viewport.centerY;
- }
- function react(oPlayer)
- {
- var _loc1_ = this;
- switch(_loc1_.nSegment)
- {
- case 0:
- _loc1_.oData.bGermBot = null;
- break;
- case 1:
- _loc1_.oData.bGermMid = null;
- break;
- case 2:
- _loc1_.oData.bGermTop = null;
- }
- delete _loc1_.mcBuild.mcGerm;
- oPlayer.getGerm(_loc1_);
- }
- function getNoisePeriod()
- {
- return this.lowerLimit + Math.random() * this.variation;
- }
- }
-