Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 hitTestObject和self calculation哪个更好?(Actionscript)_Actionscript 3_Flash_Actionscript - Fatal编程技术网

Actionscript 3 hitTestObject和self calculation哪个更好?(Actionscript)

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

我的意思是,使用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.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快一点