mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Empty params reset to current texture size
If the width and height aren't provided, it resets the body's size to match the current frame of the game object's texture.
This commit is contained in:
parent
4c25d12b44
commit
7af6e5477f
1 changed files with 4 additions and 0 deletions
|
@ -1072,6 +1072,7 @@ var Body = new Class({
|
|||
/**
|
||||
* Sizes and positions this Body's boundary, as a rectangle.
|
||||
* Modifies the Body's `offset` if `center` is true (the default).
|
||||
* Resets the width and height to match current frame, if no width and height provided.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#setSize
|
||||
* @since 3.0.0
|
||||
|
@ -1088,6 +1089,9 @@ var Body = new Class({
|
|||
|
||||
var gameObject = this.gameObject;
|
||||
|
||||
if(width === undefined) { width = gameObject.frame.data.sourceSize.w; }
|
||||
if(height === undefined) { height = gameObject.frame.data.sourceSize.h; }
|
||||
|
||||
this.sourceWidth = width;
|
||||
this.sourceHeight = height;
|
||||
|
||||
|
|
Loading…
Reference in a new issue