I am creating a simple platformer with multiple kinds of enemies. I am learning about scriptable objects and have implemented them for Items in my game following a tutorial.
I am trying to implement Enemies in the same way, but I’m not sure which (if either) structure is correct. And when I’d use one over the other. I was sketching it out on paper, so you can see that in the Imgur link below, otherwise I’ll summarize here.
Item Implementation
- Item scriptable object with itemNname, description, icon, and a Use() method
- Consumable script which derives from Item. This is what appears in the Create Asset menu. This script just defines what happens in the Use() method.
- HealthPotion Consumable asset that runs the Use() method when clicked
Proposed Enemy Implementation
- Enemy scriptable object with name, description, health, damage, (what methods should go in here? Attack()?)
- FlyingEnemy script which derives from Enemy. This is what appears in the Create Asset menu. I’m not really sure what should be defined in this script. I have things like enemy movement, animations, setting health values, floating combat text, etc. that I want to implement. I don’t think those go here, right? It doesn’t appear I can use Start() and Update() methods on scripts that derive from scriptable objects
- Eyeball Enemy asset where I set the values
Am I on the right path here? I have a current implementation set up without using scriptable objects, but it doesn’t seem scalable. Thanks for the help and any advice!