Skeleton Setup
Objective: Set up Skeleton Enemy
Following the same process as with the Spider, we take the Skeleton spritesheet, slice it and set up the Animations and Transitions for the Idle and Walk states. Then we look at the code and we have being doing a lot of repetition in the Enemy movement and logic. This defeats the point of the Enemy base abstract class that was set up.
We move the movement and flip logic along with the variables and initialization from the Moss Giant and Spider classes to the Enemy class using virtual methods. Doing this also implements the DRY pattern (Don’t Repeat Yourself) and cleans up the individual enemy classes which can now just use an override to call the bass implementation and also add speicfic logic to each enemy class.