Jump to content

[SOLVED] : autorun feature ?


lesvieuxcrevards

Recommended Posts

I added a few other things to ours:

I have a global variable that is set to true upon the keypress that activates autorun. That variable is set to false for certain keypresses  [w,a,d,s] or when the surface is water. 

I added a custom keypress handler that checks for '8' which activates autorun or inactivates it, and movement keys which disable it.

I added a check to onEachFrame for the state of the global variable and when that is true there is a call to a small function that executes the autorun animation and also checks to see if the the player is on/in water.  If so, the global variable is set to false. By tying this to onEachFrame there is no need for an extra loop.

I hope that this helps.

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
  • Discord

×
×
  • Create New...