In the Lite-C Workshop 15 tutorial, you learn how to write code to control the camera using the joystick. In the Lite-C Workshop 18 tutorial, you learn how to write code to control the car using the keyboard. I modified the code so that I can move the car forward and backward using the keyboard. How do I control the car using joystick?
Code:
action my_car()
{
while (1)
{
if (key_a && key_cuu)
my.pan += 3*time_step;
if (key_s && key_cuu)
my.pan -= 3*time_step;
if (key_a && key_cud)
my.pan -= 3*time_step;
if (key_s && key_cud)
my.pan += 3*time_step;
if (key_cuu)
c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);
if (key_cud)
c_move (my, vector(-15*time_step, 0, 0), nullvector, GLIDE);
wait (1);
}
}