0 votes
by (120 points)
I am trying to make characters in a game but I am having trouble, because I can't make characters as a class. I want to be able to make characters as a class so that I can make object based stats.

I was thinking about something like the code bellow, but my problem is I don't know how to call the constructor. I don't know how to interact with the classes correctly and how to get or set the variables. I  have only started using this software a few days ago.

class Character{
constructor(Wisdom,Strength, Constitution, Charisma, Dexterity, Intelligence){
this.Wisdom = Wisdom;
this.Strength = Strength;
this.Constitution = Constitution;
this.Charisma = Charisma;
this.Dexterity = Dexterity;
this.Intelligence = Intelligence;

Character mainCharacter = new Character($Wisdom, $Strength, $Constitution, $Charisma, $Dexterity, $Intelligence);

1 Answer

0 votes
by (159k points)

The Classes documentation on the MDN site may help you, however it should be noted that the class feature is not equally supported by all the major brands of web-browser in particular Internet Explorer.