ID:1206669
 
(See the best response by Dariuc.)
Code:
Run()
switch(input("Which state?") in list ("Walk","Run","MaxRun","Superspeed"))
if("Walk")
usr.icon_state=""
step_size=8
if("Run")
usr.icon_state="Run"
step_size=12
if("MaxRun")
usr.icon_state="Run"
step_size=15
if("Superspeed")
usr.icon_state="Run"
step_size=20


Problem description:

At the moment, this is my running system.. It doesn't work very smoothly, and I'm really open to suggestions. I do like the old BYOND movement, moving one frame by pressing an arrow once. I'd like to have it like that, moving one frame by pressing the arrow once, but having some sort of delay, so running would be faster by comparison.

With the way it is now, it's hard to be exactly infront of a mob and punch, due to the different step sizes and whatnot.. Anyone have any ideas?

Edit: This is my TEST running system. When I figure out a good system, it won't be -verb press- to change running. Just to state.:P
I understand that you are new to the forums and perhaps BYOND, a lot of these topics have already been discussed.

Here's a quick example of someone doing a run button via the HUD
www.byond.com/forum/?post=924097&hl=run#comment2964279

Here's another by using the r key
http://www.byond.com/forum/?post=1122237&hl=run

Here's a good one that show you how to add a fatigue type system
http://www.byond.com/ forum/?post=572925&hl=sprint#comment1654462

This one adds an extra step to the player when they active the command
http://www.byond.com/forum/?post=154880&hl=sprint
Well, I know how to make buttons, and easy running commands. I already have a stamina-depletion system for running planned when I figure out a good way to make running actually work. Step Size is already altered in this code. As I said,it won't always be a "Change Speed" verb. It's just like this for now until I can find a running system I like.

Do you remember in old BYOND when you'd press the arrow Up key once, and it'd move your entire base all the way to the next north frame, instead, now it only moves it a few pixels, based on the step_size. I need a system where I can make it so it always moves 1 frame by pressing the key once, and then I can work on speed of moving to those frames.
In response to Osiris1997
Osiris1997 wrote:
Well, I know how to make buttons, and easy running commands. I already have a stamina-depletion system for running planned when I figure out a good way to make running actually work. Step Size is already altered in this code. As I said,it won't always be a "Change Speed" verb. It's just like this for now until I can find a running system I like.

Do you remember in old BYOND when you'd press the arrow Up key once, and it'd move your entire base all the way to the next north frame, instead, now it only moves it a few pixels, based on the step_size. I need a system where I can make it so it always moves 1 frame by pressing the key once, and then I can work on speed of moving to those frames.

Tile based movement is still usable in byond. To enable it delete the step_size variable settings created when your project was first made.

Unless you wish to stay with pixel movement.
If you wish to stay with pixel movement it is as easy as changing the step size of the mob that is moving to simulate running.
Oh. Thanks, lmao. I had no clue it was that simple. Yeah, Tile -Based Movement is what I was going for. Thank you for that. Now I just need a way to get the mob to go faster, so it runs. Is there any var based on tile movement that could help with that?

Or rather, a way to set a delay so the walking is slower than normal moving?
In response to Osiris1997
Best response
Osiris1997 wrote:
Oh. Thanks, lmao. I had no clue it was that simple. Yeah, Tile -Based Movement is what I was going for. Thank you for that. Now I just need a way to get the mob to go faster, so it runs. Is there any var based on tile movement that could help with that?

Or rather, a way to set a delay so the walking is slower than normal moving?

I usually override the mob's movement.

I give the mob a var called move delay and move wait.

when the player moves, the move wait is set equal to world.time+ the delay.

If the wait has passed, then allow the mob to move, otherwise return to prevent the mob from moving.

I'm not sure how many other ways to do that there are but that's what I use, in code form it looks like:
mob
var
delay=3
wait=0
//---------
Move()
if(wait<world.time)
wait=world.time+delay
..()
else
return
This works perfectly. Thank you, really.