Hold Key to Toggle Run?

Started by EnnarGames, Tue 15/03/2022 18:28:02

Previous topic - Next topic

EnnarGames

I had a thought about a running mechanic for my game. Rather than having the character in a constant sprint, or using the Thimbleweed Park double-click-to-run feature, what if you could toggle a running mode just by holding a key on the keyboard? Clicking without walks, but holding shift and clicking runs.

Is there a way to do that? If it also changed the cursor icon to reflect the toggle that would be even better!

Thank you guys so much!!  :-D
“Art is an object riddled with sharp edges that can cut you.  You can pound all those edges away and make it smooth and make it safe, but what you’re left with is just a shapeless blob.  It’s safe and it’s smooth, but it’s uninteresting.” Ron Gilbert

Khris

#1
The basic idea is to check for  IsKeyPressed(403) || IsKeyPressed(404)  when you process a left click in walk mode. Depending on true or not, change the player's view / movement speed accordingly before sending them off with player.Walk().

You will also have to reset to normal walk speed after they stop, if walking somewhere triggers a cutscene where the player also walks (since they'd still run otherwise)

EnnarGames

Quote from: Khris on Tue 15/03/2022 21:29:27
The basic idea is to check for  IsKeyPressed(403) || IsKeyPressed(404)  when you process a left click in walk mode. Depending on true or not, change the player's view / movement speed accordingly before sending them off with player.Walk().

You will also have to reset to normal walk speed after they stop, if walking somewhere triggers a cutscene where the player also walks (since they'd still run otherwise)

This is awesome! Thank you so much!
“Art is an object riddled with sharp edges that can cut you.  You can pound all those edges away and make it smooth and make it safe, but what you’re left with is just a shapeless blob.  It’s safe and it’s smooth, but it’s uninteresting.” Ron Gilbert

SMF spam blocked by CleanTalk