My animation script is really just a sheet of sprites that don't animate one for each mob so
init: function( x, y, settings ) {
this.parent( x, y, settings );
// Add the animations
this.health = 100;
this.addAnim( 'efreet', 0.1, [0] );
this.addAnim( 'manticore', 0.1, [1] );
this.addAnim( 'centaur', 0.1, [2] );
this.addAnim( 'kwolf', 0.1, [3] );
this.addAnim( 'djinn', 0.1, [4] );
this.addAnim( 'wyrm', 0.1, [5] );
this.addAnim( 'frog', 0.1, [6] );
this.addAnim( 'm_citizen_1', 0.1, [7] );
this.addAnim( 'f_citizen_1', 0.1, [8] );
this.addAnim( 'ogre', 0.1, [9] );
this.addAnim( 'banshee', 0.1, [10] );
this.addAnim( 'fish', 0.1, [11] );
this.addAnim( 'oni', 0.1, [12] );
this.addAnim( 'nymph', 0.1, [13] );
this.addAnim( 'f_thaum', 0.1, [14] );
this.addAnim( 'orc', 0.1, [15] );
this.addAnim( 'aligator', 0.1, [16] );
this.addAnim( 'f_knight', 0.1, [17] );
this.addAnim( 'kobold', 0.1, [18] );
this.addAnim( 'dog', 0.1, [19] );
this.addAnim( 'duck', 0.1, [20] );
this.addAnim( 'spider', 0.1, [21] );
this.addAnim( 'wolf', 0.1, [22] );
this.addAnim( 'griffon', 0.1, [23] );
this.addAnim( 'poltergeist', 0.1, [24] );
this.addAnim( 'hyena', 0.1, [25] );
this.addAnim( 'cat', 0.1, [26] );
this.addAnim( 'panda', 0.1, [27] );
this.addAnim( 'doomorc', 0.1, [28] );
this.addAnim( 'goblin', 0.1, [29] );
this.addAnim( 'm_fighter', 0.1, [30] );
this.addAnim( 'f_fighter', 0.1, [31] );
this.addAnim( 'm_knight', 0.1, [32] );
this.addAnim( 'f_ma', 0.1, [33] );
this.addAnim( 'tiger', 0.1, [34] );
this.addAnim( 'f_wiz', 0.1, [35] );
this.addAnim( 'm_wiz', 0.1, [36] );
this.addAnim( 'boar', 0.1, [37] );
this.addAnim( 'salamander', 0.1, [38] );
this.addAnim( 'waft', 0.1, [39] );
this.addAnim( 'goose', 0.1, [40] );
this.addAnim( 'beetle', 0.1, [41] );
this.addAnim( 'hippo', 0.1, [42] );
this.addAnim( 'unicorn', 0.1, [43] );
this.addAnim( 'f_thief_old', 0.1, [44] );
this.addAnim( 'm_thief_old', 0.1, [45] );
this.addAnim( 'm_thaum', 0.1, [46] );
this.addAnim( 'm_ma_red', 0.1, [47] );
this.addAnim( 'wraith', 0.1, [48] );
this.addAnim( 'skeleton', 0.1, [49] );
this.addAnim( 'minotaur', 0.1, [50] );
this.addAnim( 'snake', 0.1, [51] );
this.addAnim( 'shark', 0.1, [52] );
this.addAnim( 'bear', 0.1, [53] );
this.addAnim( 'lizard', 0.1, [54] );
this.addAnim( 'stalker', 0.1, [56] );
this.addAnim( 'golem', 0.1, [57] );
this.addAnim( 'sabertooth_tiger', 0.1, [58] );
this.addAnim( 'm_citizen_2', 0.1, [59] );
this.currentAnim = this.anims.golem;
timer = new ig.Timer();
this.addAnim( 'default', 0.1, [1] );
this.currentAnim = this.anims.default;
},
I really don't care much what they are called on the sheet either if there is a more functional way to assign their image.
I don't know if I could in their init(); check the mob name and assign an image accordingly via a switch statement or what... If anyone has better ideas I'm all ears.
For now this is what I'm doing and it works okay...
inside init()...
switch (this.gamename){
case 'Golem':
this.currentAnim = this.anims.golem;
break;
default:
this.currentAnim = this.anims.m_citizen_2;
break;
}
...
and I spawn the creature with
settings = {"gamename":"Golem", "npc":"true", "level":1};
ig.game.spawnEntity(EntityOtherplayer,550,550,settings);
I'm currently not using level but it will multiply the entities attributes
for example
mob.hp = mob.hp + (level * 10)
mob.defense = mob.defense + (level*0.5)
I do like you idea of different kinds of mobs but I don't know if its the best given the number of mobs I need. I'm planning on having spawn points that respawn them after 5 minutes or so of the mobs .kill()