# Max speed

**URL:** https://forum.kirupa.com/t/max-speed/193144
**Category:** Uncategorized
**Created:** [July 4, 2006, 6:31pm UTC](https://forum.kirupa.com/t/max-speed/193144 "2006-07-04T18:31:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mario\_hater](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@mario\_hater](https://forum.kirupa.com/u/mario_hater)
#### Post date: [July 4, 2006, 6:31pm UTC](https://forum.kirupa.com/t/max-speed/193144/1 "2006-07-04T18:31:00Z")

</div>

i have made a swf thats supposed to let you alter the accel and everything but the max speed isnt working. here is the code i used :

onClipEvent (load) {  
\_root.speed = 0;  
\_root.maxspeed = 20;  
\_root.accel = 1;  
\_root.deccel = .9;  
}  
onClipEvent (enterFrame) {  
\_root.speed \*= \_root.deccel;  
\_x += \_root.speed;  
if (Key.isDown(Key.RIGHT)) {  
if (\_root.speed\<\_root.maxspeed) {  
\_root.speed += \_root.accel;  
}  
}  
if (Key.isDown(Key.LEFT)) {  
\_root.speed -= \_root.accel;  
}  
}

does anyone know why its not working???
