Skip to content

Commit 8de3705

Browse files
committed
Fix for CameraFrontEnd.remove() on html5
1 parent 00c7668 commit 8de3705

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

flixel/system/frontEnds/CameraFrontEnd.hx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,19 @@ class CameraFrontEnd
5757
*/
5858
public function remove(Camera:FlxCamera, Destroy:Bool = true):Void
5959
{
60-
#if !js
61-
if ((Camera != null) && FlxG.game.contains(Camera.flashSprite))
60+
var index:Int = list.indexOf(Camera);
61+
if ((Camera != null) && index != -1)
6262
{
63+
#if !js
6364
FlxG.game.removeChild(Camera.flashSprite);
64-
var index = FlxArrayUtil.indexOf(FlxG.cameras.list, Camera);
65+
#end
6566

66-
if (index >= 0)
67-
{
68-
FlxG.cameras.list.splice(index, 1);
69-
}
67+
list.splice(index, 1);
7068
}
7169
else
7270
{
7371
FlxG.log.warn("FlxG.cameras.remove(): The camera you attemped to remove is not a part of the game.");
7472
}
75-
#end
7673

7774
#if FLX_RENDER_TILE
7875
for (i in 0...list.length)

0 commit comments

Comments
 (0)