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