Is there a way to create a custom class (a separate .lua file) that simply performs some function? If so, how can it be called?
Let me explain. Currently, I have a projectile with collision detection. If the projectile strikes the enemy, I call an instance of a custom class that counts the number of times the enemy has been hit. If the enemy is hit the proper number of times, then the enemy is removed from the stage through the custom class. It works fine, but to make it work I am doing the following:
If the projectile hits the enemy, then an instance of my custom class is created (currently a Sprite set to invisible) and added to the stage. I then have to remove the invisible sprites from the stage. I am wondering if there is a way to call the custom class without it being a sprite that must be added and removed.
I hope this makes sense.