phaser/v3/src/physics/impact/components/Offset.js

29 lines
493 B
JavaScript
Raw Normal View History

2017-08-16 21:10:43 +00:00
var Offset = {
setSize: function (width, height)
{
if (height === undefined) { height = width; }
this.body.size.x = Math.round(width);
this.body.size.y = Math.round(height);
return this;
},
2017-08-16 21:10:43 +00:00
setOffset: function (x, y, width, height)
{
this.body.offset.x = x;
this.body.offset.y = y;
if (width)
{
this.setSize(width, height);
2017-08-16 21:10:43 +00:00
}
return this;
}
};
module.exports = Offset;