Hi, A long time ago, i got a script for advanced cars, and i have only used it now, and i need some help with it.
Here’s the script:
var maxspeed:Number = 10;
var maxSpeedoRotation:Number = 315;
var accel:Number = -5;
var steer:Number = .08;
var drift:Number = .9;
var speed:Number = 0;
var traction:Number = 10;
var holdArr:Array = [0, 0];
var angle:Number = 1;
var brakeForce:Number = .8;
car.onEnterFrame = function() {
so._rotation = (speed/maxspeed*maxSpeedoRotation)
car._rotation = angle*180/Math.PI;
if (Key.isDown(Key.RIGHT) || Key.isDown(Key.LEFT)) {
angle += (Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT))*steer*(Math.abs(speed)<10 ? Math.abs(speed)/10 : 1)*1.3;
}
if (!Key.isDown(Key.UP)-Key.isDown(Key.DOWN)) {
speed *= drift;
} else if (Key.isDown(Key.UP)-Key.isDown(Key.DOWN) && !Key.isDown(Key.SPACE)) {
speed = Math.min(Math.max(speed+(Key.isDown(Key.UP)-Key.isDown(Key.DOWN))*.99, accel), maxspeed);
}
Math.abs(speed)<.99 ? speed=0 : null;
if (Key.isDown(Key.SPACE)) {
speed *= brakeForce;
if (speed>1) {
steer = .099;
}
traction = 50/3;
} else {
traction = Math.max(1, Math.abs((speed-10)/3));
steer = .08;
}
speed<0 ? traction=1.0 : null;
car._x -= holdArr[0] += ((Math.cos(angle)*speed)-holdArr[0])/traction;
car._y -= holdArr[1] += ((Math.sin(angle)*speed)-holdArr[1])/traction;
};[IMG]file:///C:/DOCUME%7E1/Dancso/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/Dancso/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]
I’ve changed the maxspeedrotation from 160 to 315, to have the speed-shower thingy rotate like real, cause’ 160 was less rotation than a half circle.
So, I’ve got this working, but i need to change the speeds. The speed-shower thingy rotates too fast, and the car accelerates too fast, and when i release the ‘up’ button, it stops too quickly. I can’t really see through this code, so i need the help of someone. If somebody could tell me what to change and where, i would be very thankful
thanks in advance
~Dancso