#define init_xpos skill1
action door_left()
{
while(!player)
{
wait (1);
}
my.init_xpos = my.x;
while(1)
{
while(vec_dist(player.x, my.x > 30))
{
wait(1);
}
while(my.x > (my.init_xpos - 40))
{
my.x -= 3 * time_step;
wait(1);
}
while (vec_dist(player.x, my.x) < 100)
{
wait(1);
}
while (my.x < my.init_xpos)
{
my.x += 3 * time_step;
wait(1);
}
my.x = my.init_xpos;
wait(1);
}
}
action door_right()
{
while(!player)
{
wait(1);
}
my.init_xpos = my.x;
while(1)
{
while(vec_dist(player.x, my.x > 30))
{
wait (1);
}
while(my.x < (my.init_xpos + 40))
{
my.x += 3 * time_step;
wait(1);
}
while (vec_dist(player.x, my.x) < 100)
{
wait(1);
}
while (my.x > my.init_xpos)
{
my.x -= 3 * time_step;
wait(1);
}
my.x = my.init_xpos;
wait(1);
}
}