# Inertia moving

**URL:** <https://forum.kirupa.com/t/inertia-moving/161349>\
**Category:** programming\
**Created:** [September 3, 2005, 2:06am UTC](https://forum.kirupa.com/t/inertia-moving/161349 "2005-09-03T02:06:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElNacho](https://avatars.discourse-cdn.com/v4/letter/e/a88e57/32.png) [@ElNacho](https://forum.kirupa.com/u/ElNacho)\
**Post date:** [September 3, 2005, 2:06am UTC](https://forum.kirupa.com/t/inertia-moving/161349/1 "2005-09-03T02:06:16Z")

</div>

So I’ve got a basic inertia script, but I can’t move right (it moves me left).  
stupid tabs dont work  
Here’s the script:

function KeysDown(){[indent]if(KeyIsDown) Blob\_speed += 4;

[/indent]}

function Blob\_Move(type){[indent]if(type == left){

Blob.\_x -= Blob\_speed;  
Blob.gotoAndStop(3);  
}

else if(type == right){[indent]Blob.\_x += Blob\_speed;

Blob.gotoAndStop(2);

[/indent]}

else if(type == slowdown){[indent]Blob.\_x += Blob\_speed;

[/indent]}

[/indent]}

onEnterFrame = function(){[indent]if(Key.isDown(Key.LEFT)){[indent]KeyIsDown = true;

KeysDown();  
Blob\_Move(left);

[/indent]}

if(Key.isDown(Key.RIGHT)){[indent]KeyIsDown = true;

KeysDown();  
Blob\_Move(right);

[/indent]}

if(Key.isDown(Key.SPACE)){[indent]Blob\_Jump();

[/indent]}

else{[indent]KeyIsDown = false;

Blob\_speed \*= 0.9;  
if(Blob\_speed \<= 0.1) Blob\_speed = 0;  
Blob\_Move(slowdown);

[/indent]}

[/indent]}

Blob is the name of the movie clip, the different frames and the moving, whatever doesn’t matter. so what’s wrong with my code?
