////////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////////////////////
var walk_speed;
var turn_speed;
////////////////////////////////////////////////////////////////////////////////////
function bones_test()
{
my.pan -= 180; // face the player
while(1)
{
ent_animate(my, NULL, 0, 0); // reset all the animations
walk_speed += 1.5 * time_step; // increase walk_speed; 1.5 sets the speed
ent_animate(my, "walk", walk_speed, ANM_CYCLE); // animate the model (use "walk")
if (key_space && (turn_speed < 100)) // space was pressed?
turn_speed += 10 * time_step; // then increase turn_speed
if (!key_space && (turn_speed > 0)) // space isn't pressed?
turn_speed -= 10 * time_step; // then decrease turn_speed
if (turn_speed > 0) // got to turn?
ent_animate(my, "turn", turn_speed, ANM_ADD); // animate the model (use "turn")
wait(1);
}
}
function main()
{
level_load (""); // load an empty level
wait(2); // wait until the level is loaded
// and then now create the robot model at x = 400, y = 0, z = -50 quants
ent_create("robot.mdl", vector(400, 0, -50), bones_test);
}