From 0b19508b43bc77286e2c3491821d45b62f8ba65c Mon Sep 17 00:00:00 2001 From: zsx Date: Sat, 21 Mar 2015 23:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8FBUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/danmu/danmu/sprite.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(); }