function my_event()
{
switch (event_type)
{
case EVENT_BLOCK:
beep();
gt=5;
return;
case EVENT_ENTITY:
beep();
return;
}
}
action play(entity_number)
{
//my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY ) ;
//my.event = my_event();
STRING* rec_str = " "; // stores the name of the recorded data file
STRING* temp_str = " "; // just a temporary string
var filehandle;
str_cpy(rec_str, str_for_num(temp_str, entity_number)); // create the name of the data file depending on entity's number
str_cat(rec_str, ".txt"); // and then add it the ".txt" extension
filehandle = file_open_read(rec_str); // now we can try to open the file
if (filehandle)
{
var temp = 0;
VECTOR tempStore;
VECTOR tempStorePan;
VECTOR tempVector;
var spaceFind;
var totalSpaces=0;
var count=0;
while(file_find(filehandle, " ")>=0) count++;
file_seek (filehandle, 0, 0); // reset read position back
while(temp < count)
{
tempStore.x=file_var_read(filehandle);
tempStore.y=file_var_read(filehandle);
tempStore.z=file_var_read(filehandle);
tempStorePan.x=file_var_read(filehandle);
tempStorePan.y=file_var_read(filehandle);
tempStorePan.z=file_var_read(filehandle);
my.frame = file_var_read(filehandle); // and put them inside the array
// rotate towards target
vec_set(tempVector, tempStore.x);
vec_sub(tempVector, my.x);
vec_to_angle(my.pan, tempVector);
//move to it with collision
c_move(my, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);
temp +=1;
wait(1);
}
file_close(filehandle); // close the file
beep();
}
}