I'm wondering what the best way to go about advanced collision detection in AS2 would be. I don't mean bounding boxes, because that's fine. Specifically how do I stop the player from moving in one direction when colliding with something.
Imagine a top-down shooter. Basically I'm looking for how the collision detections were achieved in a game similar to this: http://ninjakiwi.com/Games/Action/Play/SAS-Zombie-Assault-2.html
I have an array that keeps track of the direction the player is currently moving(up, down, left, right). I also have four variables allowing the player to move in each direction if the corresponding variable is true. When the player collides with a movieclip in the collision array I set the variables relating to the directions he is moving to false, so he can't keep moving in the direction he was going when he collided with the object. The problem arises when the player is moving diagonally(two directions) and collides with something that he should be able to continue moving in one direction in. Example:
The play should be able to move in the up direction, but cannot.
Another problem is that the variables determining wether or not the player can move are set back to true when the opposite direction's key is pressed(ie. able to move right is set to true when left is pressed, since we've moved in the opposite direction). So in the previous example if you were not to move diagonally and simply move right, then hold right down while moving up until you aren't touching the object anymore you wouldn't be able to move right because the left key wasn't pressed.
It seems like I'm over complicating things, is there any way besides individually placing all walls that stop the player from moving in one direction?(Ie. If the player touches this wall, stop moving right). <--- This way doesn't allow for randomly generated maps when objects are rotated. Or is there some way I can get around this using math depending on the object rotation?
What's the easiest way to hitTest? :D