mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
The UpdateList.remove
method wouldn't flag the Game Object for removal properly if it was active. It now checks that the Game Object is in the current update list and hasn't already been inserted into the 'pending removal' list before flagging it. Fix #4544
This commit is contained in:
parent
deca3c95a3
commit
5416deaa54
1 changed files with 6 additions and 5 deletions
|
@ -193,9 +193,12 @@ var UpdateList = new Class({
|
|||
*/
|
||||
update: function (time, delta)
|
||||
{
|
||||
for (var i = 0; i < this._list.length; i++)
|
||||
var list = this._list;
|
||||
var length = list.length;
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
var gameObject = this._list[i];
|
||||
var gameObject = list[i];
|
||||
|
||||
if (gameObject.active)
|
||||
{
|
||||
|
@ -216,9 +219,7 @@ var UpdateList = new Class({
|
|||
*/
|
||||
remove: function (child)
|
||||
{
|
||||
var index = this._pendingRemoval.indexOf(child);
|
||||
|
||||
if (index !== -1)
|
||||
if (this._list.indexOf(child) !== -1 && this._pendingRemoval.indexOf(child) === -1)
|
||||
{
|
||||
this._pendingRemoval.push(child);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue