Hey,
I’ve got 2 scripts here… which see if an object is in a particular area…
The first. is the good old fashioned hitTest
onClipEvent (enterFrame) {
if (_root.hero.hitTest(this)) {
_parent.nextFrame();
}
}
And… next I have a checker which checks for the coordinates… and see if the “hero/object” is within it’s area…
onClipEvent (enterFrame) {
if (_root.hero._x>_x-60 and _root.hero._x<_x+60 and _root.hero._y>_y-15 and _root.hero._y<_y+15) {
_parent.nextFrame();
}
}
Which one is better? I heard that hitTests really lag the Flash file/computer down… So it’s better to use calculations… But… Just by looking at the code… I get the impression hitTests are better as it’s clearly more tidier…
Which is better? In terms of speed, in an enviroment where there is many more onEnterFrames occuring.
Thanks