Guest User

Untitled

a guest
Feb 6th, 2016
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             var block = new cc.Sprite(params.texture);
  2.            
  3.             block.setBBoxOffsetTop = function(offset) {
  4.                 block.offsetTop = offset;
  5.             };
  6.             block.setBBoxOffsetBottom = function(offset) {
  7.                 block.offsetBottom = offset;
  8.             };
  9.             block.setBBoxOffsetLeft = function (offset) {
  10.                 block.offsetLeft = offset;
  11.             };
  12.             block.setBBoxOffsetRight = function (offset) {
  13.                 block.offsetRight = offset;
  14.             };
  15.  
  16.             block.getBBox = function () {
  17.                 var left = block.offsetLeft || 0;
  18.                 var right = block.offsetRight || 0;
  19.                 var top = block.offsetTop || 0;
  20.                 var bottom = block.offsetBottom || 0;
  21.                
  22.                 return cc.rect(this.getPositionX() - this.getContentSize().width/2 + left,
  23.                                this.getPositionY() - this.getContentSize().height/2 + bottom,
  24.                                this.getContentSize().width - left - right, this.getContentSize().height - top - bottom);
  25.             };
Add Comment
Please, Sign In to add comment