Hi there!
I’m currently making a simple racing game in AS3… I’m not all that expierenced with games as this is only my second one.
Right now i have a dynamic text based speedometer that works as it should… The numbers in the textfield increases/decrease depending on the speed of the car. However i would like to create a proper one.(PICTURE BELOW)
I have a basic understanding of how it works… I know the “needle” would be a movieclip and would rotate round… But i’m not sure how to make this relate to the speed variable.
Code for my dynmaic text speedo…
// constants
static const maxSpeed:Number = .5;
static const accel:Number = .0002;
static const decel:Number = .0002;
static const turnSpeed:Number = .25;
// game variables
private var arrowLeft,arrowRight,arrowUp,arrowDown:Boolean;
private var lastTime:int;
private var gameStartTime:int;
private var speed:Number;
speedo.text = String(speed * 150);
if (speed < 0)
{
speedo.text = String(0);
}