# Running Problem

**URL:** <https://forum.kirupa.com/t/running-problem/68839>\
**Category:** Uncategorized\
**Created:** [October 29, 2004, 12:25pm UTC](https://forum.kirupa.com/t/running-problem/68839 "2004-10-29T12:25:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emdiesse](https://avatars.discourse-cdn.com/v4/letter/e/c0e974/32.png) [@Emdiesse](https://forum.kirupa.com/u/Emdiesse)\
**Post date:** [October 29, 2004, 12:25pm UTC](https://forum.kirupa.com/t/running-problem/68839/1 "2004-10-29T12:25:31Z")

</div>

Hello.

I have made it so when shift is down my charecter runs however i want this to be in a toggle sort of way.

Starts off as charecter walking  
Toggle once then charector starts to jog  
Toggle Twice he sprints  
Toggled three times then it goes back to the state of walking

This is my code so far where he walks and jogs when shift is pressed:

```auto

onClipEvent(load) {
 x_speed2 = 1;
 y_speed2 = 0.5;
}
onClipEvent (enterFrame) {
 if (Key.isDown(Key.SHIFT)){
  x_speed = (x_speed2*3);
  y_speed = (y_speed2*3);
 }
 else {
  x_speed = 1;
  y_speed = 0.5;
 }
}
onClipEvent (enterFrame) {
 if (Key.isDown(Key.RIGHT)) {
  _rotation = 135;
  _x+= x_speed;
  _y+= y_speed;
 }
 if (Key.isDown(Key.LEFT)) {
  _rotation = 315;
  _x-= x_speed;
  _y-= y_speed;
 }
 if (Key.isDown(Key.UP)) {
  _rotation = 45;
  _x+= x_speed;
  _y-= y_speed;
 }
 if (Key.isDown(Key.DOWN)) {
  _rotation = 225;
  _x-= x_speed;
  _y+= y_speed;
 }
 if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
  _rotation = 90;
 }
 if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
  _rotation = 0;
 }
 if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
  _rotation = 180;
 }
 if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
  _rotation = 270;
 }
}

```

How do i make it so it toggles through the walk, run, sprint stages?

Thank you 😃
