Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Strafing Movment (facing the same direction while moving)


Darklordhalos
 Share

Recommended Posts

Hey All, Just wondering if anyone had an idea how to implement this:
What I want to do is when a player holds a certian key down, the player's
character shall fix its direction (the way he/she is facing) but still be able to
move in all four directions. Ive tried editing the source at all SetPlayerDir();
so that when a key is held, the code ignores the commands to alter the player's
direction. but all this produced is some strange movement and teleporting characters.
Any one have any advice on what would be the best way to create this?

Thanks in advance, Halos.
Link to comment
Share on other sites

Instead of editing the Sub SetPlayerDir(), you want to edit where that sub is called.  I think the sub is CanMove, or PlayerMove or something, find the actual movement sub, and put and If-Then-Else sequence before the line "Call SetPlayerDir" so that if shift is held, it skips that line.  Sorry about the vagueness, I don't have VB6 at work anymore.
Link to comment
Share on other sites

Ive tried adding IFs in where the SetPlayerDir is being called, and it almost worked:
When the key was presse it stopped the character turning, but they only move in the
direction they are facing. for e.g. my character is facing UP, and I hold down the "Strafe"
key but when I move pressing the LEFT key, the character Still moves UP, in the direction
they are facing. I think its because when the character is moved by the code, it directly uses
the character's direction to work out the changes in X + Y coodinates. Ill keep trying though.
Think im going to have to edit the core of the movement code to get it working. Thanks again
for your help though Crypto :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...