action cueb_act()
{
cueball = me;
c_setminmax(me);
var aufprallwinkel[3];
var aufprall[3];
my.pan = -80;
while(1)
{
c_move(me, vector(accelerate(speed_cueball,-10*key_space*time_step,0.02),0,0), nullvector, USE_POLYGON | IGNORE_PASSABLE | IGNORE_WORLD | IGNORE_SPRITES);
if(trace_hit && hit.entity == table)
{
//set the new direction
vec_to_angle(aufprallwinkel, normal);
my.pan = my.pan+(2*((aufprallwinkel[0]+90)+180-my.pan));
speed_cueball = speed_cueball*0.85;
}
if(trace_hit && hit.entity != table)
{
// get the direction from cueball to the collide ball
vec_set(aufprall,hit.x);
vec_sub(aufprall,your.x);
vec_to_angle(your.pan,aufprall);
your.skill1 = speed_cueball*1.5;//set the speed
// get the new direction
my.pan = your.pan-my.pan; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ???
speed_cueball = speed_cueball*0.3;
wait(1);
your.skill1 = 0;
}
wait(1);
}
}