PDA

View Full Version : Weird problems with hittests::solution needed



Lord Impero
July 30th, 2006, 09:53 AM
Hi everyone,
I’ve been experiencing a funny error anomaly while making my hittests(walls) for my
Flash games. I use the getBounds and hittest method.
The thing is shown in the swf that I’ve attached when opened you can see that the character keeps rotating and when his flat side is towards the wall, he goes and disappears and goes some where.
(I know I sound crazy but take a look yourself)
Please help me and tell me what I an doing wrong
Thanks,
Impero
BTW: taken from n99
SWF:http://img144.imageshack.us/my.php?image=problemgy4.swf

SacrificialLamb
July 30th, 2006, 06:53 PM
what you are doing wrong is allowing the rotation to happen when the MC is against the wall. The wall hit thing is a while statement and because y is first that is why it only happens on x because y moves it back first then tests for x but when you’re against and x wall then it rotates moving it y will not resolve the problem till it’s moved out of the box.
A simple fix is to make all the while statement if statement char._x+=speed, or put a restriction on rotation when it’ll result in moving throw a wall. But I can’t say why n99 doesn’t have the same problem

Lord Impero
July 31st, 2006, 07:31 AM
ha ha i alreaddy tried the "if" thing but it didnt work for me :(

Increu
July 31st, 2006, 12:39 PM
get Bounds has some kind of bug sometimes...i dont know if this migth be the problem

Lord Impero
August 1st, 2006, 06:13 AM
^ any way how to fix or substitute get bounds?