This is the code i have now. (modified for lite-c).
it generate the stones and rotate them. (event is commented)
Code:
#include <acknex.h>
#include <default.c>
function bounce_event()
{
if (event_type == EVENT_IMPACT)
{
//ent_playsound(my,explode,50);
ent_remove(me); // disappear when hit
}
}
action stone_action()
{
var rotrandom[3];
var moverandom[3];
//my.emask |= ENABLE_IMPACT;
//my.event = bounce_event;
set(my,PASSABLE);
my.pan = random(360);
my.tilt = random(360);
my.roll = random(360);
moverandom[0] = random(10)-5;
moverandom[1] = random(10)-5;
moverandom[2] = random(10)-5;
while(1)
{
//ent_remove(my); also event
my.pan +=random(4)*time_step;
my.tilt +=random(5)*time_step;
result = c_move(me,vector(10*time_step,0,0),nullvector,IGNORE_YOU|GLIDE);
wait(1);
}
}
var stone =0;
function stone_spanw()
{
var stone_pos[3];
while(1)
{
stone_pos[0] = random(400);
stone_pos[1] = random(400);
stone_pos[2] = random(400);
// somthing that checks of there is space for you entity
if(stone <40)//max entity's
{
ent_create("lp_farn.mdl",vector(stone_pos[0],stone_pos[1],stone_pos[2]),stone_action);
wait(1);
stone++;
}
wait(1);
}
}
function main()
{
video_mode = 6;
video_screen = 2;
video_depth = 32;
vec_set(sky_color,vector(0,0,1)); // blue
level_load("main.wmb");
wait (3);
stone_spanw();
camera.x = -600;
camera.y = 300;
camera.z = 150;
}