Handling different type of bodies

With the entities split into parts (head, body, arms, leg), it was not possible to have different type of entities (wolf, bird, ...). I decide to create a class that handle everything that has to do with the different type of bodies.

function EntityBodyInformation() {
    this.id = 0;
    this.name = "";
    this.bodyPartCount = 0;
    // These 3 array could be combined since they are always the same size
    this.bodyPartName = [];
    this.bodyPartImageType = [];
    this.bodyPartOrder = [];
    this.hittingAnimationName = "";
    this.walkingAnimationName = "";
    this.idleAnimationName = "";
    this.gatheringAnimationName = "";

This indicate what type of body parts an entity has, which animation to use and which order to draw each parts. After adding a bird and a dog, this new class works great.

Leave a comment

Log in with itch.io to leave a comment.