home *** CD-ROM | disk | FTP | other *** search
- class org.cove.flade.surfaces.AbstractTile
- {
- var center;
- var verts;
- var normal;
- var isVisible;
- var isActivated;
- var dmc;
- var minX;
- var maxX;
- var minY;
- var maxY;
- function AbstractTile(cx, cy, rootmc)
- {
- this.center = new org.cove.flade.util.Vector(cx,cy);
- this.verts = new Array();
- this.normal = new org.cove.flade.util.Vector(0,0);
- this.isVisible = true;
- this.isActivated = true;
- if(rootmc == null)
- {
- rootmc = _root;
- }
- this.initializeContainer(rootmc);
- }
- function initializeContainer(rootmc)
- {
- if(_root.__debug__)
- {
- if(rootmc == null)
- {
- rootmc = _root;
- }
- var _loc4_ = rootmc.getNextHighestDepth();
- var _loc5_ = "_" + _loc4_;
- this.dmc = rootmc.createEmptyMovieClip(_loc5_,_loc4_);
- }
- else
- {
- this.dmc = _root;
- }
- }
- function setVisible(v)
- {
- this.isVisible = v;
- if(!v)
- {
- this.dmc.clear();
- }
- }
- function getVisible()
- {
- return this.isVisible;
- }
- function setActiveState(a)
- {
- this.isActivated = a;
- }
- function getActiveState()
- {
- return this.isActivated;
- }
- function createBoundingRect(rw, rh)
- {
- var _loc2_ = this.center.y - rh / 2;
- var _loc3_ = this.center.y + rh / 2;
- var _loc5_ = this.center.x - rw / 2;
- var _loc4_ = this.center.x + rw / 2;
- this.verts.push(new org.cove.flade.util.Vector(_loc4_,_loc3_));
- this.verts.push(new org.cove.flade.util.Vector(_loc4_,_loc2_));
- this.verts.push(new org.cove.flade.util.Vector(_loc5_,_loc2_));
- this.verts.push(new org.cove.flade.util.Vector(_loc5_,_loc3_));
- this.setCardProjections();
- }
- function ReCreateBoundingRect(rw, rh)
- {
- var _loc2_ = this.center.y - rh / 2;
- var _loc3_ = this.center.y + rh / 2;
- var _loc5_ = this.center.x - rw / 2;
- var _loc4_ = this.center.x + rw / 2;
- this.verts = new Array();
- this.verts.push(new org.cove.flade.util.Vector(_loc4_,_loc3_));
- this.verts.push(new org.cove.flade.util.Vector(_loc4_,_loc2_));
- this.verts.push(new org.cove.flade.util.Vector(_loc5_,_loc2_));
- this.verts.push(new org.cove.flade.util.Vector(_loc5_,_loc3_));
- this.setCardProjections();
- }
- function testIntervals(boxMin, boxMax, tileMin, tileMax)
- {
- if(boxMax < tileMin)
- {
- return 0;
- }
- if(tileMax < boxMin)
- {
- return 0;
- }
- var _loc2_ = tileMax - boxMin;
- var _loc1_ = tileMin - boxMax;
- if(Math.abs(_loc2_) < Math.abs(_loc1_))
- {
- return _loc2_;
- }
- return _loc1_;
- }
- function setCardProjections()
- {
- this.getCardXProjection();
- this.getCardYProjection();
- }
- function getCardXProjection()
- {
- this.minX = this.verts[0].x;
- var _loc2_ = 1;
- while(_loc2_ < this.verts.length)
- {
- if(this.verts[_loc2_].x < this.minX)
- {
- this.minX = this.verts[_loc2_].x;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.maxX = this.verts[0].x;
- _loc2_ = 1;
- while(_loc2_ < this.verts.length)
- {
- if(this.verts[_loc2_].x > this.maxX)
- {
- this.maxX = this.verts[_loc2_].x;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function getCardYProjection()
- {
- this.minY = this.verts[0].y;
- var _loc2_ = 1;
- while(_loc2_ < this.verts.length)
- {
- if(this.verts[_loc2_].y < this.minY)
- {
- this.minY = this.verts[_loc2_].y;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.maxY = this.verts[0].y;
- _loc2_ = 1;
- while(_loc2_ < this.verts.length)
- {
- if(this.verts[_loc2_].y > this.maxY)
- {
- this.maxY = this.verts[_loc2_].y;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function onContact()
- {
- }
- }
-