Skip to content

Commit fb04cd4

Browse files
committed
Containers are now exclusive
1 parent 183896f commit fb04cd4

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/gameobjects/container/Container.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ var Container = new Class({
137137
{
138138
gameObject.on('destroy', this.remove, this);
139139

140-
if (gameObject.type === 'Container')
140+
if (gameObject.parentContainer)
141141
{
142-
gameObject.parentContainer = list;
142+
gameObject.parentContainer.remove(gameObject);
143143
}
144+
145+
gameObject.parentContainer = list;
144146
},
145147

146148
/**
@@ -157,10 +159,7 @@ var Container = new Class({
157159
{
158160
gameObject.off('destroy', list.remove, this);
159161

160-
if (gameObject.type === 'Container')
161-
{
162-
gameObject.parentContainer = null;
163-
}
162+
gameObject.parentContainer = null;
164163
},
165164

166165
/**

0 commit comments

Comments
 (0)