Skip to content

Instantly share code, notes, and snippets.

@jquave
Created August 7, 2012 19:30
Show Gist options
  • Save jquave/3288655 to your computer and use it in GitHub Desktop.
Save jquave/3288655 to your computer and use it in GitHub Desktop.
// If player isn't pressing a button and isn't in a jump, slow down, or slide around
//if(Mathf.Abs(MacroGetAxis("Horizontal"))<0.1 && !qGrounded) {
if(Mathf.Abs(MacroGetAxis("Horizontal"))<0.1 && qGrounded) {
// Walking
var slideFactor = 1.4;
// Sprinting
if(Mathf.Abs(currentRunSpeed)>sprintSpeed) slideFactor = 1.1;
// Crouching
if(MacroGetAxisRaw("Vertical")==-1) slideFactor = 1.018;
if(Mathf.Abs(currentRunSpeed)<0.0000001) currentRunSpeed = 0; // Helps with syncing due to float rounding, etc
// currentRunSpeed /= slideFactor;
try {
currentRunSpeed /= slideFactor;
}
catch (err) {
print (err.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment