I am struggling with the implementation of events and actions. I am obviously missing a major concept.
I am trying to get collision events for entities. I see examples like this in the docs:
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); my.event = bounce_event;
while(1)
{
c_move(me,vector(5*time_step,0,0),nullvector,0); wait(1);
}
}
And there are even simpler examples of actions and events like this:
action rotate_plane()
{
while (1)
{
my.pan = my.pan + 0.1;
wait (1);
}
}
function main()
{
video_mode = 7;
level_load ("work10.wmb");
wait(2); // wait until the level is loaded
vec_set(camera.x,vector(-500, 0, 100)); // place the camera at x = -500, y = 0, z = 100
}
However <blush>, I don’t understand how the actions (e.g., bounceball and rotate_plane in these examples) get associated with my entity (e.g., _MyEntity). Can actions only be associated with entities from within WED or can they be associated with entities from C-Lite? I’m sorry my question is so vague… I am very new to GameStudio.
Currently I do this in main (very paraphrased):
level_load("MyWord.wmb");
wait (2);
_MyEntity = ent_create ("MyEntity.mdl", vector(0, 0, 0), NULL);
I don’t understand (no sh*t) how to have a function called when a specific event happens to _MyEntity.
Thanks!
Steve