home *** CD-ROM | disk | FTP | other *** search
- class GDK.Node extends GDK.Generic
- {
- var onCollision;
- var world;
- var onMove;
- var children;
- var target;
- static var COLLISION_OK = 1;
- static var COLLISION_CANCEL = 2;
- static var COLLISION_SKIP_EVENT = 4;
- var className = "Node";
- var renderable = true;
- var x = 0;
- var y = 0;
- var z = 0;
- var collisionMask = 0;
- function Node()
- {
- super();
- }
- function checkCollisionList(objects, flag, options, maxCol)
- {
- if(maxCol == null)
- {
- maxCol = 1.7976931348623157e+308;
- }
- if(flag == null)
- {
- flag = this.collisionMask;
- }
- var _loc4_ = 0;
- var _loc5_ = undefined;
- var _loc2_ = objects.length;
- while((_loc2_ = _loc2_ - 1) > -1)
- {
- if(objects[_loc2_] != this)
- {
- if((flag & objects[_loc2_].collisionMask) > 0)
- {
- if(_loc5_ = this.checkCollision(objects[_loc2_]))
- {
- _loc4_ = _loc4_ + 1;
- if(!(_loc5_ & GDK.Node.COLLISION_SKIP_EVENT) && this.onCollision(objects[_loc2_],options) == GDK.Node.COLLISION_CANCEL || _loc4_ >= maxCol)
- {
- break;
- }
- }
- }
- }
- }
- return _loc4_;
- }
- function checkCollision(obj)
- {
- return false;
- }
- function moveTo(x, y, z)
- {
- this.moveBy(x - this.x,y - this.y,z - this.z);
- }
- function moveBy(x, y, z)
- {
- if(x || y || z)
- {
- this.x += x;
- this.y += y;
- this.z += z;
- this.positionChanged(x,y,z);
- }
- }
- function moveToGlobally(x, y, z)
- {
- }
- function positionChanged(xShift, yShift, zShift)
- {
- this.world.onObjectMoved(this);
- this.onMove();
- this.queueForDisplay();
- }
- function pv_positionChanged(xShift, yShift, zShift)
- {
- var _loc2_ = this.children.length;
- while((_loc2_ = _loc2_ - 1) > -1)
- {
- this.children[_loc2_].moveBy(xShift,yShift,zShift);
- }
- this.queueForDisplay();
- }
- function display()
- {
- this.setDisplay.apply(this,arguments);
- delete this.queueForDisplay;
- }
- function setDisplay()
- {
- this.target._x = this.x;
- this.target._y = this.y;
- }
- function getUpdates()
- {
- this.world.updateList.addMember(this);
- }
- function cancelUpdates()
- {
- this.world.updateList.removeMember(this);
- }
- function onBeginParent()
- {
- if(!this.affectChildren)
- {
- return undefined;
- }
- this.positionChanged = this.pv_positionChanged;
- }
- function onEndParent()
- {
- delete this.positionChanged;
- }
- function timelineUpdate()
- {
- this.queueForDisplay();
- }
- }
-