RhenaudTheLukark / CreateYourFrisk

Rhenaud The Lukark's Unitale fork
GNU General Public License v3.0
132 stars 56 forks source link

Add enemy management #85

Closed AllyTally closed 3 years ago

AllyTally commented 3 years ago

This PR adds the encounter function CreateEnemy(script,x,y), which lets you create an enemy while the encounter is running. This function returns the ScriptWrapper object, which is not added to the default enemies table.

It also adds the Remove() function from enemy scripts which removes the enemy from the battle. Note that this does not actually remove the script reference; it solely removes the GameObject (and removes it from the internal enemies list.) It will throw an error if you try to destroy an enemy which is already destroyed.

Finally, this PR shortens an outdated error when the enemies table does not exist, to be more clear and concise.