View Single Post
  #3  
Old 02-21-2006, 04:42 PM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
To do it, theres a few certain rules to consider.

1) We only need to do the sliding when only one direction is being pressed. If the player is trying to walk on a diagonal, the sliding should not be done. (It's fairly easy to prove this).

2) We only need to do sliding if the player has not moved as a result of ther normal movement.

3) The wall detection doesn't care about walls directly to the side of the player, only those directly in front of, and those on the diagonals to the players base. Basically, you take the area in front of the player, and then shift it left or right (from the characters facing direction) up to 1 tiles worth, each direction relating to each sliding direction. If these tiles are clear, then the player can slide in that direction. The reason we need to look at the shifts 0 to 1 is because we dont know how much the player is clipping the wall, how large the gap they are sliding into is (we don't want to over measure and detect the wall on the other side).

4) It is worthwhile to note that because this is not looking at the tiles to the side of the player, this allows the player to move onto a wall to accomplish the sliding, which may sound odd, but is actually how the original movement behaves.

5) If you use a sliding speed greater than 1/16 (1 pixel) per timeout, then you need to check that the player is not overshooting the free area. For example, if you have a gap which is perfectly the width of the player, its likely that they will need to slide in order to line up with it. If the sliding speed is too fast, they will slide back and forth between the two sides, and never align with the gap.

If you want any clarification on the things I've said, dont hesitate to ask!
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote