Im trying to make a car game, but i cannot get the acceleration code right. With this code:
if(gas){
speed += 3;
}else if(break_ && !(speed < 6)){
speed -= 3;
}else if(!break_ && !gas && !(speed < 6)){
speed -= 0.3;
}else{
speed = 6;
}
it is up on 1000 within 5 secounds. I tried multiplying it with smaller numbers, but it still doesnt work(in fact it got worse). So, how can this be improved so it has reasonable parameters? Asof the maximum speed, i can implement that on my own.