The code:
Code: Select all
Override void Tick()
{
Super.Tick();
GlideToPlayer(); //Call the function
}
void GlideToPlayer()
{
For(let i = BlockThingsIterator.Create(self,128); i.Next();)
{
Actor other = i.thing;
If(other==self)
{Continue;}
double distance = Distance3D(other);
If(distance>128)
{Continue;}
If(other is "PlayerPawn")
{
A_Face(other); //Face the player
VelFromAngle(10.0);
}
}
}
}