# Button movement with inertia

**URL:** https://forum.kirupa.com/t/button-movement-with-inertia/52303
**Category:** Uncategorized
**Created:** [May 22, 2004, 2:57am UTC](https://forum.kirupa.com/t/button-movement-with-inertia/52303 "2004-05-22T02:57:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pickkill](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@pickkill](https://forum.kirupa.com/u/pickkill)
#### Post date: [May 22, 2004, 2:57am UTC](https://forum.kirupa.com/t/button-movement-with-inertia/52303/1 "2004-05-22T02:57:32Z")

</div>

how could i modify this script so that it has inertia, and so that i can movie diagonally? is there a better way of doing mc movement with keypresses?

on (keyPress “\<Left\>”) {  
currentX = this.\_x;  
this.\_x = currentX - 2;  
\_root.bug.\_rotation = 270;  
}  
on (keyPress “\<Right\>”) {  
currentX = this.\_x;  
this.\_x = currentX + 2;  
\_root.bug.\_rotation = 90;  
}  
on (keyPress “\<Up\>”) {  
currentY = this.\_y;  
this.\_y = currentY - 2;  
\_root.bug.\_rotation = 360;  
}  
on (keyPress “\<Down\>”) {  
currentY = this.\_y;  
this.\_y = currentY + 2;  
\_root.bug.\_rotation = 180;  
}

thanks  
:}
