Im trying to make panels for my enemies to show their pan yet my panel code in the enemy action script works but then makes hundreds of panels as the enemys move.
This is the condensed code in my enemy script:
PANEL* panel //define panel
action enemy_dummy
{
WHILE(1)
{
panel = pan_create("digits (0, -80, 2, standard_font, 1, my.enemy_pan);flags=visible | overlay;",1);
my.enemy_pan = ang(my.pan);
digits_set(panel,1,my.enemy_pan);
vec_set(temp,my.x);
vec_to_screen(temp,camera);
panel.pos_x = temp.x;
panel.pos_y = temp.y;
if (you != NULL)
{
//blah blah blah
}
wait(1)
}
}
I put ptr_remove(panel) just below wait(1). This stops the constant spawning of panels yet only one panel will work on one enemy and not the others. All the other panels will either be in the centre of screen or to the very top left of screen.
How do I stop this?
Is there a better way of creating panels for each entity and to follow them ?
Many thanks for any hints.