Help for the car script

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Help for the car script

Post by metal_head » Thu Mar 27, 2008 8:27 pm

I want when I accelerate my car the wheels to start spinning.my car has the animation,but I don't know how to add it in the script

Code: Select all

RunCar[()
{
// Main Routine.

	// Acceleration
	// Check if key 15 is being pressed. Key 15 is, S
	if(IsKeyDown(15))
	{
	// Key is Pressed. Increase the vehicle speed.
	SPEED=SPEED+ACCELRATE;
		if(tOFF > 90)
		{
		SPEED=0;
		tOFF=0;
		}
		// Limit Speed to Max Speed
		if(SPEED > MAXSPEED)
		{
		SPEED=MAXSPEED;
                
		}
	}

	// Brakeing
	// Check if key 27 is being pressed. Key 27 is, X
	if(IsKeyDown(27))
	{
	// Vehicle is braking, slow down.
	SPEED=SPEED-BRAKERATE;
		if(SPEED < 0)
		{
		SPEED=0;
		}
	}
I need to add the command here right?

I have this at the beginning:

Code: Select all

ANIMATION [spin] // Accelerate Animation
I think I must add this:

Code: Select all

PlayAnimation(ANIMATION)
But I don't know how to add it and where. PLEASE I NEED YOUR KIND HELP (I would also be happy if there is a better car script,but that's another question :D)

Post Reply