VECTOR* vecDust =
{
x=0; y=0; z=0;
}
//--------------------------------------------------------------------
// Action: Player
//--------------------------------------------------------------------
action act_player()
{
...
player = my; //I'm the player
player.emask |= (ENABLE_IMPACT | ENABLE_ENTITY);
player.event = bounce_wall;
...
while(1)
{
HandleMovement();
HandleCamera();
wait(1);
}
}
//--------------------------------------------------------------------
// Event- Hit on the wall/water
//--------------------------------------------------------------------
function bounce_wall()
{
if(you != NULL)
{
if( /*hit in the points*/ )
{
//do nothing...
}
else //hit in the wall & water entities
{
vecDust.x = hit.x; //i started in here so I know what vertex of the player hit the wall... hit.vertex
vecDust.y = hit.y;
vecDust.z = hit.z;
//play some effects...
VECTOR tempVel,tempNormal;
vec_set(tempVel, vector(0,0,5));
vec_set(tempNormal,normal);
var count = 0;
while(count < 3)
{
vec_randomize(tempVel,10); //make sure the dust goes away from the impact position
vec_normalize(tempNormal,2 + random(5));
vec_add(tempVel,tempNormal);
if( str_cmpi(strWaterSkin,hit.texname) ) //water splash
{
effect_local(splash, 1, vecDust, tempVel);
}
else //dust
{
effect_local(dust, 1, vecDust, tempVel);
}
count += 1;
wait(1);
}
}
wait(1);
}
}