I am trying to make a IF statement that basically says this...
"If 'character' is a prototype of 'player' then...", but i'm not quite sure how to write this in code. If the character IS, then it will go with the player route. If it is not, then it will detect it as a monster and operate the opposite function instead.
var actor = {
expCounter: function (character){
if (player){ // This is what I want to change
$("#playerexpbaroverlay").animate({
height: dwarf.exp
}, 200);
}
else if (monster){ //if character is not a prototype of player, do this
$("#bossexpbaroverlay").animate({
height: dwarf.exp
}, 200);
}
if (dwarf.exp > 199){
dwarf.level++
dwarf.exp = 1;
dom.setText("playerlevel", dwarf.level)
$("#playerexpbaroverlay").animate({
height: dwarf.exp
}, 100);
}
}
}
Extra code I have:
New = Object.create;
player = New (actor),
monster = New (actor),
dwarf = New(player),
angel = New(monster);