USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 2/6/09 06:49 AM
Sign-Up: 08/01/08
Posts: 1,536
So I'm trying to hitTest my character with a wall. I use while and try this:
onClipEvent(EnterFrame) { while (_root.walls.hitTest(_x , _y , true)) {trace("it works!");} }
Now the second I hit the walls, flash crashes...
What am I doing wrong here?
"When you look at yourself from a universal standpoint, something inside always reminds or informs you that there are bigger and better things to worry about. "- Einstein
Posted at: 2/6/09 07:29 AM
Sign-Up: 06/25/04
Posts: 4,922
At 2/6/09 06:49 AM, 4urentertainment wrote: What am I doing wrong here?
Nothing.
Oh. Apart from the fact you're forgetting to ensure that the walls never hit test the object during the loop (normally people do something intelligent like move the damn thing out of the way of the walls in these while loops, rather than do nothing). Since you appear to have absolutely no method of ensuring that once the loop starts it never breaks, it fires until your processor melts.
Tell the movieclip to get out of the walls during the while loop.
Current build for ThreedeeTiles : Mountain Goat Previous: Lamprey, Kookaburra
Posted at: 2/6/09 07:34 AM
Sign-Up: 09/10/04
Posts: 3,548
Uhm, flash shouldn't crash, just need 15 sec to timeout the script.
Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.
Posted at: 2/6/09 07:37 AM
Sign-Up: 05/03/06
Posts: 532
on(enterFrame){ getURL("http://www.newgrounds.com"); }
if ya like loops try that for 15 seconds see what happens :)
All times are Eastern Standard Time (GMT -5) | Current Time: 03:27 PM
<< Back