0

我正在为一个大学项目使用“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!');
        }
    }
});
4

0 回答 0