[Solved] Characters class doubt in construction

i divide my class in two one for characters status and other to only class of my characters

   public class Characters {

        private databaseconn dbo;
        private int Codcharecters;
        private String Namechar;
        private float CurrentHeal;
        private float MaxHeal;
        private float CurrentStamania;
        private float MaxStamania;
        private float CurrentMagic;
        private float MaxMagic;
        private float HealRegen;
        private float StamaniaRegen;
        private float MagicRegen;
        private int PlayerLevel;
        private int SkillPoints;
        private float CurrentXP;
        private float NeededXP;
        private String Race;
     /*****************************/
  /* private String Classes;
        private int Strength;
        private int Health;
        private int Agility;
        private int Accuricy;
        private int Kownleged;
        private int Will;
*/
        public Characters() {
            this.dbo = new databaseconn();
            dbo.testconn();
        }

        /**
         * *********************************************
         * @param codchar
         */
        /*               SETS */
        public void SetCodCharacters(int codchar) {
            this.Codcharecters = codchar;
        }

        public void SetNameChar(String nameChar) {
            this.Namechar = nameChar;
        }

        public void SetCurrentHeal(float currentheal) {
            this.CurrentHeal = currentheal;
        }

        public void SetMaxHeal(float maxheal) {
            this.MaxHeal = maxheal;
        }

        public void SetCurrentStamania(float currentStamania) {
            this.CurrentStamania = currentStamania;
        }

        public void SetMaxStamania(float maxStamania) {
            this.MaxStamania = maxStamania;
        }

        public void SetCurrentMagic(float currentMagic) {
            this.CurrentMagic = currentMagic;
        }

        public void SetHealRegen(float healRegen) {
            this.HealRegen = healRegen;
        }

        public void SetStamaniaRegen(float stamaniaRegen) {
            this.StamaniaRegen = stamaniaRegen;
        }

        public void SetMagicRegen(float magicRegen) {
            this.MagicRegen = magicRegen;
        }

        public void SetPlayerLevel(int playerLevel) {
            this.PlayerLevel = playerLevel;
        }

        public void SetCurrentXP(float currentXP) {
            this.CurrentXP = currentXP;
        }

        public void SetNeededXP(float neededXP) {
            this.NeededXP = neededXP;
        }

        /**
         * ***********************************************
         * @return 
         */
        /*          GETS       */
        public int GetCodCharacters() {
            return Codcharecters;
        }

        public String GetNameChar() {
            return Namechar;
        }

        public float GetCurrentHeal() {
            return CurrentHeal;
        }

        public float GetMaxHeal() {
            return MaxHeal;
        }

        public float GetCurrentStamania() {
            return CurrentStamania;
        }

        public float GetMaxStamania() {
            return MaxStamania;
        }

        public float GetCurrentMagic() {
            return CurrentMagic;
        }

        public float GetMaxMagic() {
            return MaxMagic;
        }

        public float GetHealRegen() {
            return HealRegen;
        }

        public float GetStamaniaRegen() {
            return MagicRegen;
        }

        public float GetMagicRegen() {
            return MagicRegen;
        }

        public int GetPlayerLevel() {
            return PlayerLevel;
        }

        public int GetSkillsPoints() {
            return SkillPoints;
        }

        public float GetCurrentXP() {
            return CurrentXP;
        }

        public float GetNeededXP() {
            return NeededXP;
        }
    }

GameClass

public class GameClass {
     private String NameClasses;
    private int Strength;
    private int Health;
    private int Agility;
    private int Accuricy;
    private int Kownleged;
    private int Will;
 private databaseconn dbo;

    public GameClass() {
        this.dbo = new databaseconn();
        dbo.testconn();
    }
}

Well done? What’s the question…?

1 Like

i create a single class with a atributes of characters class and race our divide in three classes
one for the characters
other for the classes and other for the races
and create 3 tables in my database

Ok… I think you’re asking if this is the correct way to do it. And the answer is yes and no. How extensible do you want it to be. For a simple pong game, would I go through the entire process of interfacing everything out and code separation - probably not. If I were making a huge MMORPG then certainly yes.

So the answer is “there is no correct way” - it depends entirely on your context. But if you want an answer - you need to look into entity systems.

I found this to be a very good introduction:

https://www.gamedev.net/resources/_/technical/game-programming/understanding-component-entity-systems-r3013

thanks
for the help
to save the posicion of my char in the world can put char class
and this topic can be close