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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...