Attach this action to an entity and it will move in its relative x direction
at the speed of time_step each frame, replace x with y or z to move in those directions.
Code:
action move_me
{
while(me)
{
my.x += time_step;
wait(1);
}
}
This does the same except moves with collision detection;
Code:
action move_me
{
while(me)
{
c_move(my, vector(time_step, 0, 0), nullvector, glide);
wait(1);
}
}
This does the same except uses the up and down cursor keys to move in x and -x.
Code:
action move_me
{
while(me)
{
c_move(my, vector((key_cuu-key_cud)*time_step, 0, 0), nullvector, glide);
wait(1);
}
}
Last example with all 4 cursor keys controlling x and y movement.
Code:
action move_me
{
while(me)
{
temp.x = key_cul-key_cur;
temp.y = key_cuu-key_cud;
temp.z = 0;
c_move(my, temp.x, nullvector, glide);
wait(1);
}
}