我正在使用'Enchant.js'javascript框架为大学项目制作游戏并收到此错误(导致游戏冻结)。我甚至都不知道'_dirty'的含义是什么,而且完全超出了我的深度。 (我用谷歌搜索'_dirty',并了解它指的是'未保存的更改',但我并不完全确定它是什么意思。) 非常感谢任何帮助。
var Meds = Class.create(Sprite,
{
//Two argument constructor takes in X and Y co-ordinate for patient
initialize: function(x,y)
{
//Inherit all enchant.Sprite properties using it's constructor
Sprite.apply(this, [16,16]);
//Set image and co-ordinates for meds
this.image = Game.instance.assets['art/icon0.gif'];
this.frame = 13;
this.x = x;
this.y = y;
//Add medicine to 'scene' group
scene.addChild(this);
},
//Function for removing medicine
remove: function()
{
//Remove from 'scene' group
scene.removeChild(this);
//Delete med from array
delete meds[this.key];
//Delete med from memory
delete this;
//Decrement counter variable
currentMedAmount--;
}
});
game.rootScene.addEventListener('enterframe', function()
{
for(var i=0; i < meds.length; i++)
{
if(sally.within(meds[i], 35) && game.input.Z_BUTTON)
{
meds[i].remove();
console.log('WORKING!');
}
}
});