#include <acknex.h>
#include <default.c>
action buterfly()
{
var anim_percentage;
player = my;
while (1)
{
c_move (my, vector(20 * (key_w - key_s) * time_step, 0 , 0), nullvector, IGNORE_PASSABLE | GLIDE);
/////the final 0 in the above c_move instruction is set to 0 for no gravity , if you create it in the air it will stay in the air
/////if you want gravity pulling the butterfly down change it to -1 or lower
my.pan -= 6 * mouse_force.x * time_step;
my.pan +=10 * (key_a - key_d)* time_step;
camera.x=my.x-200*cos(my.pan);
camera.y=my.y-200*sin(my.pan);
camera.z=my.z+100;
camera.tilt=-10;
camera.pan=my.pan;
ent_animate(my, "fly", anim_percentage, ANM_CYCLE);// the butterfly will animate its fly all the time , use your frame name for fly
anim_percentage += 6 * time_step; // "6" controls the animation speed
wait (1);
}
}
function main()
{
video_mode = 7;
video_screen = 1;
sound_vol = 100;
level_load("your level here");
wait(4);
player=ent_create("butterfly.mdl",vector(0,0,200),buterfly);
}
here should be all you need to load a level with your butterfly
model and control it with wasd it will always run its fly animating rename fly to your frame name