home *** CD-ROM | disk | FTP | other *** search
- class CShot extends MovieClip
- {
- var pos;
- var oldPos;
- var dir;
- var speed;
- var myType;
- static var LENGTH = 50;
- function CShot()
- {
- super();
- }
- function init(pos_, dir_, speed_, myType_)
- {
- this.pos = pos_;
- this.oldPos = this.pos.duplicate();
- this.dir = dir_;
- this.speed = speed_;
- this.myType = myType_;
- }
- function process(dTime)
- {
- var _loc2_ = this.speed * dTime / 1000;
- if(this.myType == 2)
- {
- this.oldPos.reinit(this.pos.x,this.pos.y,this.pos.z);
- }
- this.pos.x += this.dir.x * _loc2_;
- this.pos.y += this.dir.y * _loc2_;
- this.pos.z += this.dir.z * _loc2_;
- }
- function screenSynchronize(objTransform)
- {
- var _loc2_ = {x:0,y:0,k:0};
- var _loc5_ = {x:0,y:0,k:0};
- var _loc6_ = undefined;
- var _loc4_ = undefined;
- var _loc3_ = undefined;
- objTransform.getScreenXY(this.pos.x,this.pos.y,this.pos.z,_loc2_);
- objTransform.getScreenXY(this.pos.x - this.dir.x * CShot.LENGTH,this.pos.y - this.dir.y * CShot.LENGTH,this.pos.z - this.dir.z * CShot.LENGTH,_loc5_);
- _loc4_ = _loc2_.x - _loc5_.x;
- _loc3_ = _loc2_.y - _loc5_.y;
- _loc6_ = Math.sqrt(_loc4_ * _loc4_ + _loc3_ * _loc3_);
- this._x = _loc2_.x;
- this._y = _loc2_.y;
- if(this.myType == 1)
- {
- this._xscale = _loc6_ * 10 * 0.55 + 67.5;
- this._yscale = _loc2_.k * 100 * 0.6 + 40;
- this._rotation = Math.atan2(_loc3_,_loc4_) * 180 / 3.141592653589793;
- }
- else if(this.myType == 2)
- {
- this._xscale = this._yscale = _loc2_.k * 100;
- this._rotation = Math.atan2(_loc3_,_loc4_) * 180 / 3.141592653589793 + 90;
- }
- else if(this.myType == 3)
- {
- this._xscale = _loc6_ * 10 * 0.55 + 67.5;
- this._yscale = _loc2_.k * 110;
- this._rotation = Math.atan2(_loc3_,_loc4_) * 180 / 3.141592653589793;
- }
- else if(this.myType == 4)
- {
- this._xscale = this._yscale = _loc2_.k * 100;
- }
- }
- function disable()
- {
- this.removeMovieClip();
- }
- }
-