car speed/mouse
Posted: Thu Jun 07, 2007 2:02 am
hello,
I was wondering if there was a code to make my car (player actor) move faster depending on how far away it is from the crosshair. Like if my crosshair was 30 pixels away from the car the car would be moving somewhere around 3 velocity, but if the crosshair was 120 pixels away from the car then the car would be moving somewhere around 7 velocity.
I am using this code now, but it doesn't do exactly what i want.
angle = direction(x, y, crosshair.x, crosshair.y);
directional_velocity = 8;
By the way the crosshair follows the mouse...
any help is appreciated
I was wondering if there was a code to make my car (player actor) move faster depending on how far away it is from the crosshair. Like if my crosshair was 30 pixels away from the car the car would be moving somewhere around 3 velocity, but if the crosshair was 120 pixels away from the car then the car would be moving somewhere around 7 velocity.
I am using this code now, but it doesn't do exactly what i want.
angle = direction(x, y, crosshair.x, crosshair.y);
directional_velocity = 8;
By the way the crosshair follows the mouse...
any help is appreciated