Dhryn
September 29th, 2006, 04:36 PM
I am using the following code to find out if the wall hits the corners of my character. this code is placed on the character
topleft = _root.wall.hitTest(getBounds(_root).xMin,getBounds (_root).yMin,true);
Then changing it appropriately for the other three corners. I then placed dynamic text fields on the screen which link to the variables for testing purposes. This worked fine.
I then tried to use this code on my character to stop him walking through walls. Code also placed on character
if(topleft && bottomleft){
this._x += 5;
}
but with this code, when the character hits the wall it overloads the computer and stops responding.
If any one can tell me why it is doing this and how I can get around this problem without massive code changes to my whole game.
topleft = _root.wall.hitTest(getBounds(_root).xMin,getBounds (_root).yMin,true);
Then changing it appropriately for the other three corners. I then placed dynamic text fields on the screen which link to the variables for testing purposes. This worked fine.
I then tried to use this code on my character to stop him walking through walls. Code also placed on character
if(topleft && bottomleft){
this._x += 5;
}
but with this code, when the character hits the wall it overloads the computer and stops responding.
If any one can tell me why it is doing this and how I can get around this problem without massive code changes to my whole game.