Do you want to clone the object?
Try something like this:
Code: Select all
Object.prototype.clone = function()
{
    var Object = function(){};
    Object.prototype = this;
    return new Object();
}
var myCreature = new Creature("lol", CreatureTypeList.axilict);
var mySecondCreature = myCreature.clone();
mySecondCreature.name = "haha";
console.log(myCreature.name) // lol
console.log(mySecondCreature.name) // haha
To make a list of random creatures run a loop to make new instances or clones..
Code: Select all
var myCreatureList = [];
for( var i = 0; i <= 50; i++ )
{
    var randomName = Math.floor( new Date().getTime() * Math.random() ).toString(16);
    var creature = new Creature( randomName , CreatureTypeList.axilict );
    myCreatureList.push(creature);
}
Code: Select all
var myCreatureList = [];
var myCreature = new Creature("", CreatureTypeList.axilict);
for( var i = 0; i <= 50; i++ )
{
    var clonedCreature = myCreature.clone();
    clonedCreature.name = Math.floor( new Date().getTime() * Math.random() ).toString(16); // random name
    myCreatureList.push(clonedCreature);
}
Fighting for peace is declaring war on war. If you want peace be peaceful.