So sollte es jetzt klappen, dass dein Heli animiert wird, wenn du ihn vorher per R-Taste angeschaltet hast.
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
var motor_an = 0;
function toggle_motor()
{
motor_an = (motor_an == 0);
}
function main()
{
level_load ("homework18.wmb");
wait (2);
vec_set(camera.x,vector(0,-480,1000)); // set a static position for the camera
vec_set(camera.pan,vector(90,-68,0)); // set the correct orientation for the camera
on_r = toggle_motor;
}
var anim_speed;
var motor_an;
action my_car()
{
while (1)
{
if (key_d)
my.pan -= 3*time_step; // decrease the pan angle of the car
if (key_w ) // press and hold the "Space" key to move the car
c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);
if (key_a ) // press and hold the "Space" key to move the car
my.pan += 3*time_step; // decrease the pan angle of the car
if (key_cul)
my.roll += 3*time_step; // increase the pan angle of the car
if (key_cur)
my.roll -= 3*time_step; // decrease the pan angle of the car
if (key_cuu ) // press and hold the "Space" key to move the car
my.tilt += 3*time_step; // increase the pan angle of the car
if (key_cud ) // press and hold the "Space" key to move the car
my.tilt -= 3*time_step; // increase the pan angle of the car
// move the car using relative_speed
wait (1);
ent_animate(my, "fly", anim_speed, ANM_CYCLE);
anim_speed += motor_an*4000*time_step;
}
}
Last edited by the_clown; 05/07/09 13:34.