mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
StaticBody.reset
in Arcade Physics would ignore the x
and y
values given to it. If given, they're now used to reset the parent Game Object before the body is updated. Fix #4224
This commit is contained in:
parent
cc55ee73cf
commit
af5b1f2427
2 changed files with 6 additions and 3 deletions
|
@ -231,6 +231,7 @@ one set of bindings ever created, which makes things a lot cleaner.
|
|||
* The Texture Tint Pipeline had a logic error that would cause every 2001st quad to either be invisible, or pick-up the texture of the 2000th quad by mistake. The `batchQuad` and `batchTri` methods how handle re-assigning the batch texture if they cause a batch flush as part of their process.
|
||||
* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it, causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report)
|
||||
* Changing `scaleX` or `scaleY` on a `MatterImage` or `MatterSprite` would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206 (thanks @YannCaron)
|
||||
* `StaticBody.reset` in Arcade Physics would ignore the `x` and `y` values given to it. If given, they're now used to reset the parent Game Object before the body is updated. Fix #4224 (thanks @samme)
|
||||
|
||||
### Examples and TypeScript
|
||||
|
||||
|
|
|
@ -619,14 +619,14 @@ var StaticBody = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Updates this Static Body's position based on the current Game Object it is bound to.
|
||||
* Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates.
|
||||
* Similar to `updateFromGameObject`, but doesn't modify the Body's dimensions.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.StaticBody#reset
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} x - The x coordinate to reset the body to.
|
||||
* @param {number} y - The y coordinate to reset the body to.
|
||||
* @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate.
|
||||
* @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate.
|
||||
*/
|
||||
reset: function (x, y)
|
||||
{
|
||||
|
@ -637,6 +637,8 @@ var StaticBody = new Class({
|
|||
|
||||
this.world.staticTree.remove(this);
|
||||
|
||||
gameObject.setPosition(x, y);
|
||||
|
||||
gameObject.getTopLeft(this.position);
|
||||
|
||||
this.updateCenter();
|
||||
|
|
Loading…
Add table
Reference in a new issue