|
-
Problem with hitTestPoint, when shape flag 'true'?
Hello there.
I've got this problem with hitTestPoint. When I test with the 'shape flag' set to false it detects hits out to the bounding box of the symbol (as you'd expect), but when I set the shape flag to true I get no hit detections at all.
Here's the (very simple!) code I'm using...
Code:
for (i=0;i<Math.floor(width);i++) {
j = -100;
do {
j++;
} while (!this.hitTestPoint(x+i, y+j, true) && j < 100);
pixelYs.push(j);
};
Is there any reason why I'm not getting ANY hit detections with the flag set to true? I'm testing the same x and y coords. Pretty much stumped.
In case you're wondering I'm trying to get the best performance out of a scroller game. Any land shapes with rises or falls are loaded with an array (pixelYs[]) of y heights that the game loop can 'get', instead of having to do a lot of looping hitTestPoints to determine how high the player should be positioned over the piece of ground they're standing on.
Any help, well appreciated!
Cheers.
Last edited by moosefetcher; 07-08-2010 at 09:19 AM.
Reason: typo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|