Calling Arcade Physics Body.reset on a Game Object that doesn't have any bounds, like a Container, would throw an error about being unable to access getTopLeft. If this is the case, it will now set the position to the given x/y values

This commit is contained in:
Richard Davey 2019-06-11 18:20:56 +01:00
parent 13180b9a9a
commit 77859b1cdf
2 changed files with 10 additions and 2 deletions

View file

@ -141,7 +141,8 @@ The following changes took place in the Pointer class:
* `Tilemap.createDynamicLayer` would fail if you called it without setting the `x` and `y` arguments, even though they were flagged as being optional. Fix #4508 (thanks @jackfreak)
* `RenderTexture.draw` didn't work if no `x` and `y` arguments were provided, even though they are optional, due to a problem with the way the frame cut values were added. The class has been refactored to prevent this, fixing issues like `RenderTexture.erase` not working with Groups. Fix #4528 (thanks @jbgomez21 @telinc1)
* The `Grid` Game Object wouldn't render in Canvas mode at all. Fix #4585 (thanks @fyyyyy)
* If you had a `Graphics` object in the display list immediately after an object with a Bitmap Mask it would throw an error `Uncaught TypeError: Cannot set property 'TL' of undefined`. Fix #4581 (thanks @Petah)
* If you had a `Graphics` object in the display list immediately after an object with a Bitmap Mask it would throw an error `Uncaught TypeError: Cannot set property 'TL' of undefined`. Fix #4581 (thanks @Petah @Loonride)
* Calling Arcade Physics `Body.reset` on a Game Object that doesn't have any bounds, like a Container, would throw an error about being unable to access `getTopLeft`. If this is the case, it will now set the position to the given x/y values (thanks Jazz)
### Examples, Documentation and TypeScript

View file

@ -1208,7 +1208,14 @@ var Body = new Class({
gameObject.setPosition(x, y);
gameObject.getTopLeft(this.position);
if (gameObject.getTopLeft)
{
gameObject.getTopLeft(this.position);
}
else
{
this.position.set(x, y);
}
this.prev.copy(this.position);