Actionscript 3 hitTestObject和self calculation哪个更好?(Actionscript)
我的意思是,使用object.hitTestObject或计算如下边界对性能有什么好处:Actionscript 3 hitTestObject和self calculation哪个更好?(Actionscript),actionscript-3,flash,actionscript,Actionscript 3,Flash,Actionscript,我的意思是,使用object.hitTestObject或计算如下边界对性能有什么好处: if(obj.x > obj2.x && obj.x < obj2.x + obj2.width && obj.y > obj2.y && obj.y < obj2.y + obj2.height) { trace('spaceship damaged!!!'); } //or using if(obj.hitTestOb
if(obj.x > obj2.x && obj.x < obj2.x + obj2.width &&
obj.y > obj2.y && obj.y < obj2.y + obj2.height)
{
trace('spaceship damaged!!!');
}
//or using
if(obj.hitTestObject(obj2))
{
trace('spaceship damaged by hitTestObject!!!');
}
if(obj.x>obj2.x&&obj.xobj2.y&&obj.y
你在实践中更多地使用什么?什么更有效率?性能百分比有多少用于自我计算?20%? 40%? 60%?请参阅以下性能比较文章: 你喜欢的问题
这篇文章让您对您的问题有了很好的了解 HitTest似乎是最快的,这似乎是合理的,因为我认为Adobe的API将尽可能优化以获得最佳性能 [编辑]至于回答这个问题,bitmapdata.com似乎比Will Kru快一点