|
4 registered members (Grant, Ayumi, alibaba, Quad),
5,526
guests, and 0
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Question on ENABLE_IMPACT
[Re: MarcsVision]
#295650
10/26/09 18:17
10/26/09 18:17
|
Joined: Aug 2008
Posts: 133 Sweden, Stockholm
Enduriel
Member
|
Member
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
|
Taken from the manual, this is how you define EVENTS:
// 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);
}
}
so change your my.ENABLE_CLICK = ON to my.emask |= ENABLE_CLICK
|
|
|
Re: Question on ENABLE_IMPACT
[Re: MarcsVision]
#295698
10/26/09 23:03
10/26/09 23:03
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! Here's a quote from the manual to that effect  Functions assigned to or called by entities - that means all functions in which the my pointer is not zero - are automatically terminated at their next wait call. All other functions in which my is zero, such as the main() function, will keep running and won't change, even if a different script was assigned in WED to the new level.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
|