I have been experimenting weird behaviors all around my entities, and while cleaning up my old code (he's from 2004, OLD syntaxes and everthing), i found this:
while(arrow_1.tilt<= -81)
{arrow_1.tilt = -80;waitt(1);}
while(arrow_1.tilt>= 45)
{arrow_1.tilt = 44;waitt(1);}
while(Camera_in_block==1&&flecha_1.tilt<0)
{arrow_1.tilt -= -10*time_frame;wait(1);}
while(Camera_in_block==1&&flecha_1.tilt>1)
{arrow_1.tilt -= 10*time_frame;wait(1);}
Yup, four 'WHILES' inside a function. Maybe in the old engine that might be necessary, but what now? Wich of the following functions is faster: One 'while' inside a function, or one 'while' inside the WHOLE SCRIPT, calling other functions?
fuction firstfunction()
{
while(1)
{
if(arrow_1.tilt<= -81)
{arrow_1.tilt = -80;waitt(1);}
if(arrow_1.tilt>= 45)
{arrow_1.tilt = 44;waitt(1);}
if(Camera_in_block==1&&flecha_1.tilt<0)
{arrow_1.tilt -= -10*time_frame;wait(1);}
if(Camera_in_block==1&&flecha_1.tilt>1)
{arrow_1.tilt -= 10*time_frame;wait(1);}
}
wait(1);
}
fuction secondfunction()
{
if(movement!=1)
{
if(arrow_1.tilt<= -81)
{arrow_1.tilt = -80;waitt(1);}
if(arrow_1.tilt>= 45)
{arrow_1.tilt = 44;waitt(1);}
if(Camera_in_block==1&&flecha_1.tilt<0)
{arrow_1.tilt -= -10*time_frame;wait(1);}
if(Camera_in_block==1&&flecha_1.tilt>1)
{arrow_1.tilt -= 10*time_frame;wait(1);}
}
wait(1);
}
function functioncaller()
{
while(1)
{
secondfunction();
thirdfunction();
//...
wait(1);
}
}
Thanks in advance.