Skip to content

Commit 9959dce

Browse files
committed
Passing a Frame object to Bob.setFrame would fail, as it expected a string or integer. It now checks the type of object, and if a Frame it checks to make sure it's a Frame belonging to the parent Blitter's texture, and if so sets it. Fix phaserjs#4516
1 parent 3504819 commit 9959dce

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Tweens created in a paused state couldn't be started by a call to `play`. Fix #4525 (thanks @TonioParis)
1515
* If both Arcade Physics circle body positions and the delta equaled zero, the `separateCircle` function would cause the position to be set `NaN` (thanks @hizzd)
1616
* The `CameraManager` would incorrectly destroy the `default` Camera in its shutdown method, meaning that if you used a fixed mask camera and stopped then resumed a Scene, the masks would stop working. The default camera is now destroyed only in the `destroy` method. Fix #4520 (thanks @telinc1)
17+
* Passing a Frame object to `Bob.setFrame` would fail, as it expected a string or integer. It now checks the type of object, and if a Frame it checks to make sure it's a Frame belonging to the parent Blitter's texture, and if so sets it. Fix #4516 (thanks @NokFrt)
1718

1819

1920

src/gameobjects/blitter/Bob.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
var Class = require('../../utils/Class');
8+
var Frame = require('../../textures/Frame');
89

910
/**
1011
* @classdesc
@@ -149,6 +150,10 @@ var Bob = new Class({
149150
{
150151
this.frame = this.parent.frame;
151152
}
153+
else if (frame instanceof Frame && frame.texture === this.parent.texture)
154+
{
155+
this.frame = frame;
156+
}
152157
else
153158
{
154159
this.frame = this.parent.texture.get(frame);

0 commit comments

Comments
 (0)