# Ship pulling left

**URL:** https://forum.kirupa.com/t/ship-pulling-left/154197
**Category:** Uncategorized
**Created:** [July 7, 2005, 5:51pm UTC](https://forum.kirupa.com/t/ship-pulling-left/154197 "2005-07-07T17:51:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![VoS](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@VoS](https://forum.kirupa.com/u/VoS)
#### Post date: [July 7, 2005, 5:51pm UTC](https://forum.kirupa.com/t/ship-pulling-left/154197/1 "2005-07-07T17:51:41Z")

</div>

Hey.  
Can anyone tell me why the ship starts to pull left after flying around with it for a bit (use arrow keys to controll)

all code is on the movieclip.  
[AS]  
onClipEvent (enterFrame) {  
if(!start1){  
start1=true;  
/// Thrust  
speed=0;  
speedMax=10;  
accelSpeed=3;  
brakeSpeed=1;  
/// Turning  
rotation=0;  
rotSpeed=3;  
rotMax=20;  
}

norotpress=1;  
if (Key.isDown(Key.RIGHT)) {  
rotation=rotation+rotSpeed;  
norotpress=0;  
} else if (Key.isDown(Key.LEFT)) {  
rotation=rotation-rotSpeed;  
norotpress=0;  
}  
if(norotpress==1){  
if(rotation\<0){  
rotation=rotation+(rotSpeed/2);  
}  
if(rotation\>0){  
rotation=rotation-(rotSpeed/2);  
}  
}  
if(rotation\<-rotMax){  
rotation=-rotMax;  
}  
if(rotation\>rotMax){  
rotation=rotMax;  
}  
this.\_rotation=this.\_rotation+rotation;

// TRUST  
if (Key.isDown(Key.UP)) {  
speed=speed+accelSpeed;  
if(speed\>speedMax){  
speed=speedMax;  
}  
} else if (Key.isDown(Key.DOWN)) {  
if(speed\<0){  
speed=0;  
}  
speed=speed-brakeSpeed;  
}  
var angle = (this.\_rotation \* Math.PI/180)-(Math.PI/2);  
trace(angle);  
var xpercent = Math.cos(angle);  
var ypercent = Math.sin(angle);  
this.\_x += speed \* xpercent;  
this.\_y += speed \* ypercent;  
}  
[/AS]

thanks
