home *** CD-ROM | disk | FTP | other *** search
- WindGauge = function(mc)
- {
- this.mc = mc;
- this.mc.obj = this;
- GAME.addListener(this);
- };
- t = WindGauge.prototype;
- t.mc = false;
- t.minAngle = -90;
- t.maxAngle = 90;
- t.difAngle = t.maxAngle - t.minAngle;
- t.windiesMinFrame = 1;
- t.windiesMaxFrame = 100;
- t.windiesDifFrame = t.windiesMaxFrame - t.windiesMinFrame;
- t.windPer = 0;
- t.destRot = 0;
- t.curArrowRot = 0;
- t.curOLRot = 0;
- t.startLoop = function()
- {
- this.mc.onEnterFrame = function()
- {
- this.obj.loop();
- };
- };
- t.stopLoop = function()
- {
- delete this.mc.onEnterFrame;
- };
- t.loop = function()
- {
- var _loc2_ = this.destRot;
- this.curArrowRot += (_loc2_ - this.curArrowRot) * 0.3;
- this.curOLRot += (this.curArrowRot - this.curOLRot) * 0.1;
- if(Math.abs(this.curOLRot - _loc2_) < 0.5)
- {
- this.curArrowRot = _loc2_;
- this.curOLRot = _loc2_;
- this.stopLoop();
- }
- this.windPer = (this.curArrowRot - this.minAngle) / this.difAngle;
- this.mc.windper_out = this.windPer;
- this.mc.arrow_mc._rotation = this.curArrowRot;
- this.mc.ol_mc._rotation = this.curOLRot;
- };
- t.onWindDirectionChange = function(direction)
- {
- this.destRot = direction;
- this.startLoop();
- };
-