home *** CD-ROM | disk | FTP | other *** search
- class Game.Objects.CollisionObject extends Engine.PongObject
- {
- var edges;
- static var EDGE_DEFAULT = 0;
- static var EDGE_COLLISION = 1;
- function CollisionObject()
- {
- super();
- }
- function createEdges(TL, TR, BR, BL)
- {
- this.edges = [new _types_.ShapeEdge(TL,TR),new _types_.ShapeEdge(TR,BR),new _types_.ShapeEdge(BR,BL),new _types_.ShapeEdge(BL,TL)];
- var _loc3_ = undefined;
- var _loc4_ = undefined;
- var _loc2_ = undefined;
- var _loc5_ = this.edges.length;
- while((_loc5_ = _loc5_ - 1) > -1)
- {
- _loc3_ = _loc2_ = this.edges[_loc5_].a;
- _loc4_ = _loc2_.b;
- _loc2_.center = new Vector(_loc3_.x + (_loc4_.x - _loc3_.x) * 0.5,_loc3_.y + (_loc4_.y - _loc3_.y) * 0.5);
- _loc2_.radius = 0.5 * (_loc2_.length = _loc2_.span = new Vector(_loc4_.x - _loc3_.x,_loc4_.y - _loc3_.y).length);
- _loc2_.direction = _loc2_.span.getNormalized();
- _loc2_.normal = _loc2_.direction.cross();
- _loc2_.angle = Math.atan2(_loc2_.direction.y,_loc2_.direction.x);
- _loc2_.props = _loc4_.props;
- }
- }
- function angleToVector(angle)
- {
- var _loc1_ = angle / 180 * 3.141592653589793;
- return new Vector(Math.sin(_loc1_),- Math.cos(_loc1_),0);
- }
- function vectorToAngle(v)
- {
- return Math.atan2(v.y,v.x) / 3.141592653589793 * 180 + 90;
- }
- }
-