HTML and CSS Reference
In-Depth Information
if(obj.p.col) {
var result = this.collision.checkBounds(obj.p,obj.p.col,start);
if(result) {
return result;
}
}
return false;
},
_hitTest: function(obj,collision) {
if(obj != this && this != collision &&
this.p.type && (this.p.type & obj.p.collisionMask )) {
var col = Q.overlap(obj,this);
return col ? this : false;
}
return false;
},
collide: function(obj) {
var col;
if(obj.p.collisionMask & this.collision.p.type) {
while(col = this._tileCollision(obj,col ? col.start : 0)) {
if(col) {
var destX = col.destX - col.point[0],
destY = col.destY - col.point[1];
obj.p.x = destX;
obj.p.y = destY;
if(col.direction == 'top' || col.direction == 'bottom') {
obj.p.vy = 0;
} else {
obj.p.vx = 0;
}
obj.trigger('hit',this.collision);
obj.trigger('hit.tile',col);
}
}
}
col = this.detect(this._hitTest,obj,this.collision);
if(col) {
obj.trigger('hit',col);
obj.trigger('hit.sprite',col);
}
}
});
The collisionLayer setter method sets the TileLayer that should handle collisions.
Search WWH ::




Custom Search