Therefore, instead of having:
Code: Select all
FlyingEnemy:Model
Definitions
FlyingEnemyLife:Byte
OnCollision
CurrentModel.FlyingEnemyLife--;
if (!CurrentModel.FlyingEnemyLife) @RemoveModel();
Code: Select all
void TestCollision(model m)
{
m.life--;
if (!life) @RemoveModel(Model:m);
}
So how can I do this?
The life variable can't be set in each enemy models with the same name.
So I tried to pass the needed var in the function:
Code: Select all
OnCollision
TestCollision(CurrentModel, CurrentModel.FlyingEnemyLife);
...
void TestCollision(model m, byte life) { life--; }
I was even thinking of having only one enemy model, but that would introduce a lot of code to setup the collision boxes and to display the correct meshes. And I wouldn't need the TestCollision function since everything would be in one model...
Thanks for your help !