- 注册时间
- 2005-2-13
- 最后登录
- 2018-4-24
版主
- 积分
- 18
|
发表于 2007-8-7 22:33:34
|
显示全部楼层
事件是這樣設置的,拜託看教程和查手冊............
Example (lite-C):
// The following example shows how to use events for an object that flies ahead until it collides with a block or entity.
// The event function then plays a collision sound and lets the object ricochet from the surface.
function bounce_event()
{
switch (event_type)
{
case EVENT_BLOCK:
ent_playsound(my,whamm,50);
vec_to_angle(my.pan,bounce); // change direction
return;
case EVENT_ENTITY:
ent_playsound(my,boingg,50); // play a different sound
vec_to_angle(my.pan,bounce); // change direction
return;
}
}
action bounceball()
{
my.emask |= ENABLE_BLOCK | ENABLE_ENTITY; // make entity sensitive for block and entity collision
my.event = bounce_event;
while(1)
{
c_move(me,vector(5*time_step,0,0),nullvector,0); // move ahead until obstacle is hit
wait(1);
}
} |
|