diff --git a/lib/danmu/danmu/sprite.js b/lib/danmu/danmu/sprite.js index 05794eb..3a366c6 100644 --- a/lib/danmu/danmu/sprite.js +++ b/lib/danmu/danmu/sprite.js @@ -41,7 +41,7 @@ module.exports = { move: function() { this.x += this.speed.x; this.y += this.speed.y; - if (this.children !== null) { + if (!typeof this.children == "undefined") { for (var i = 0; i < this.children.length; i++) { this.children[i].speed = this.speed; this.children[i].move(); @@ -53,7 +53,7 @@ module.exports = { * 向此精灵添加一个子精灵 */ appendChild: function(sprite) { - if (this.children === null) { + if (typeof this.children == "undefined") { this.children = []; } this.children.push(sprite); @@ -63,7 +63,7 @@ module.exports = { * 渲染子精灵 */ drawChildren: function() { - if (this.children !== null) { + if (!typeof this.children == "undefined") { for (var i = 0; i < this.children.length; i++) { this.children[i].draw(); }