Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var block = new cc.Sprite(params.texture);
- block.setBBoxOffsetTop = function(offset) {
- block.offsetTop = offset;
- };
- block.setBBoxOffsetBottom = function(offset) {
- block.offsetBottom = offset;
- };
- block.setBBoxOffsetLeft = function (offset) {
- block.offsetLeft = offset;
- };
- block.setBBoxOffsetRight = function (offset) {
- block.offsetRight = offset;
- };
- block.getBBox = function () {
- var left = block.offsetLeft || 0;
- var right = block.offsetRight || 0;
- var top = block.offsetTop || 0;
- var bottom = block.offsetBottom || 0;
- return cc.rect(this.getPositionX() - this.getContentSize().width/2 + left,
- this.getPositionY() - this.getContentSize().height/2 + bottom,
- this.getContentSize().width - left - right, this.getContentSize().height - top - bottom);
- };
Add Comment
Please, Sign In to add comment