home *** CD-ROM | disk | FTP | other *** search
- class Engine.PongObject extends GDK.Node
- {
- var target;
- var onDisplay;
- var assetID = "square";
- static var FRAME_TIME = Game.PongLevels.FRAME_TIME;
- var className = "PongObject";
- var autoAddToScene = true;
- var width = 0;
- var height = 0;
- var left = 0;
- var right = 0;
- var top = 0;
- var bottom = 0;
- static var RIGHT_DIR = "right";
- static var LEFT_DIR = "left";
- static var __inited = false;
- function PongObject()
- {
- super();
- if(!Engine.PongObject.__inited)
- {
- this.init();
- }
- }
- function onAddToWorld()
- {
- if(this.autoAddToScene)
- {
- this.addToScene();
- }
- }
- function setDisplay()
- {
- this.target._x = this.x;
- this.target._y = this.y;
- this.onDisplay.apply(this,arguments);
- }
- function init()
- {
- mx.events.EventDispatcher.initialize(Engine.PongObject.prototype);
- Engine.PongObject.__inited = true;
- }
- function findIntersection4p(l0p0, l0p1, l1p0, l1p1)
- {
- var _loc3_ = ((l1p1.x - l1p0.x) * (l0p0.y - l1p0.y) - (l1p1.y - l1p0.y) * (l0p0.x - l1p0.x)) / ((l1p1.y - l1p0.y) * (l0p1.x - l0p0.x) - (l1p1.x - l1p0.x) * (l0p1.y - l0p0.y));
- if(0 <= _loc3_ && _loc3_ <= 1)
- {
- return new Vector(l0p0.x + _loc3_ * (l0p1.x - l0p0.x),l0p0.y + _loc3_ * (l0p1.y - l0p0.y),0);
- }
- return null;
- }
- }
-