home *** CD-ROM | disk | FTP | other *** search
- class com.neodelight.v2D.PointSprite extends com.neodelight.v2D.Sprite
- {
- var size;
- var boundingRect;
- var collisionStyle;
- var spareOwner;
- var owner;
- var colGhosts;
- var flex;
- var v;
- var pos;
- var tpos;
- var colNewVx;
- var colNewVy;
- var colPos;
- var colPartner;
- var colType;
- var colNewPartnerVx;
- var colNewPartnerVy;
- function PointSprite(mc, f, weight, flags, collisionPartners)
- {
- super(mc,f,weight,flags,collisionPartners,undefined);
- this.size.x = 0;
- this.size.y = 0;
- this.size.z = 0;
- this.boundingRect.p1.x = this.boundingRect.p0.x;
- this.boundingRect.p1.y = this.boundingRect.p1.y;
- this.collisionStyle = 5;
- this.updateTotalBoundingRect();
- }
- function move()
- {
- super.move();
- }
- function collisionCheck2(partner)
- {
- if(this.spareOwner && this.owner == partner)
- {
- return undefined;
- }
- if(this.boundingRect.p0.x <= partner.pos.x + partner.size.x && this.boundingRect.p1.x >= partner.pos.x && this.boundingRect.p0.y <= partner.pos.y + partner.size.y && this.boundingRect.p1.y >= partner.pos.y)
- {
- this.colGhosts.push({pos:0,obj:partner});
- if(this.flex)
- {
- if(this.v.x > 0)
- {
- if(Math.round(this.pos.x * 1000) / 1000 < Math.round(partner.pos.x * 1000) / 1000 && Math.round(this.tpos.x * 1000) / 1000 >= Math.round(partner.pos.x * 1000) / 1000)
- {
- this.colNewVx = Math.abs(this.v.x) * this.flex * -1;
- }
- }
- else if(this.v.x < 0)
- {
- if(Math.round(this.pos.x * 1000) / 1000 > Math.round((partner.pos.x + partner.size.x) * 1000) / 1000 && Math.round(this.tpos.x * 1000) / 1000 <= Math.round((partner.pos.x + partner.size.x) * 1000) / 1000)
- {
- this.colNewVx = Math.abs(this.v.x) * this.flex;
- }
- }
- if(this.v.y > 0)
- {
- if(Math.round(this.pos.y * 1000) / 1000 < Math.round(partner.pos.y * 1000) / 1000 && Math.round(this.tpos.y * 1000) / 1000 >= Math.round(partner.pos.y * 1000) / 1000)
- {
- this.colNewVy = Math.abs(this.v.y) * this.flex * -1;
- }
- }
- else if(this.v.y < 0)
- {
- if(Math.round(this.pos.y * 1000) / 1000 > Math.round((partner.pos.y + partner.size.y) * 1000) / 1000 && Math.round(this.tpos.y * 1000) / 1000 <= Math.round((partner.pos.y + partner.size.y) * 1000) / 1000)
- {
- this.colNewVy = Math.abs(this.v.y) * this.flex;
- }
- }
- }
- }
- }
- function collisionCheck30(partner)
- {
- if(this.v.y > 0)
- {
- var _loc2_ = (partner.pos.y - this.pos.y) / (this.tpos.y - this.pos.y);
- if(_loc2_ <= this.colPos)
- {
- if(_loc2_ == this.colPos)
- {
- this.colGhosts.push({pos:_loc2_,obj:this.colPartner});
- }
- var _loc4_ = this.pos.x + _loc2_ * (this.tpos.x - this.pos.x) - partner.pos.x;
- if(_loc4_ <= partner.size.x && _loc4_ >= 0)
- {
- this.colPos = _loc2_;
- this.colType = partner.collisionStyle;
- this.colPartner = partner;
- if(this.flex > 0)
- {
- this.colNewVy = Math.abs(this.v.y) * -1 * this.flex;
- this.colNewVx = this.v.x * this.flex;
- }
- else
- {
- this.colNewVx = undefined;
- this.colNewVy = 0;
- }
- this.colNewPartnerVx = undefined;
- this.colNewPartnerVy = undefined;
- }
- }
- }
- }
- function getBoundingRect()
- {
- this.boundingRect.p0.x = Math.min(this.pos.x,this.tpos.x);
- this.boundingRect.p0.y = Math.min(this.pos.y,this.tpos.y);
- this.boundingRect.p1.x = Math.max(this.pos.x,this.tpos.x);
- this.boundingRect.p1.y = Math.max(this.pos.y,this.tpos.y);
- return this.boundingRect;
- }
- }
-