gamelab / kiwi.js

Kiwi.js is a blazingly fast mobile & desktop browser based HTML5 game framework. It uses CocoonJS for publishing to the AppStore.
www.kiwijs.org
MIT License
1.4k stars 195 forks source link

Group.containsDescendant() won't recurse #264

Closed BenjaminDRichards closed 8 years ago

BenjaminDRichards commented 8 years ago

The recursion call is misspelt. Better check this out.

BenjaminDRichards commented 8 years ago

containsDescendant() did not function as intended. However, it didn't crash. This is because it had two errors.

The first error was testing curMember.childType() === Kiwi.Group. This would never confirm, because Kiwi.Group is a prototype object, and Kiwi.GROUP is a constant returned by childType(). So I fixed that.

The second error was never encountered, because the first error would always fail the test. This error was simply leaving a c out, vis containsDesendant(). Once error 1 was fixed, error 2 became possible, which testing confirmed. So I fixed that too.

This function can now test the scene hierarchy beyond a single tier, as intended.