我想将自定义属性添加到我的sprite对象,但是当我尝试获取id属性时,它返回“undefined”。是否存在Phaser库错误或我做错了什么?
我的更新功能;
function update() {
//When I debug below line I can see enemyTank.tank.id property
game.physics.arcade.overlap(enemyTank.tank, mytank.tank, enemyTankHitPlayer, null, this);
}
回调功能;
function enemyTankHitPlayer(myTankSprite, enemyTankSprite) {
//enemyTankSprite.id is undefined!
}