然后抛出这个错误: TypeError:错误#1009:无法访问空对象引用的属性或方法。 在蔬菜/重力()
这是引力:
if (this.hitTestObject(tO)) // tO is my TamChar
{
trace("collide");
this.parent.removeChild(this);
this.y=-30; //i move it out the way just to ensure it doesnt double collide
this.x=210;
var hungerValue = 20;
tO.eatFood(hungerValue); //eatFood is a function in TamChar which increases his health
trace("object eaten", hungerValue);
}
任何帮助都会非常棒,谢谢,