java - Structuring Class Objects And Defining The Variables -


I am trying to create a framework in a game as a character.

Then I want to create 10 different characters and compare their statistics at different levels.

I am creating a class named character which looks like this,

  character of public class {string primary contribution; Double strength; Double Agility; Double Intelligence; Double armor; Double loss multiplayer; full health; Int mind; Int range; Int movement; Integer level; Int Quatrain; Int damage max; Public character () {} / constructor eliminates personal static id random indient (int min, maxm max) {return minute + (int) (monastery. Randum) * (maximum - min + 1)); } Int lossRange = randomInt (damage, damage, max); Double Damage = Damage + Level * Scope; } // class ends  

Then I am creating each character like this,

  public class firstcracker {string primary feature = "agility "; Int level = 0; Double strength = 17 + level * 1.9; Double Agility = 26 + Level * 1.9; Double Intelligence = 15 + Level * 1.4; Double armor = 0.64; Double Damage Multiplayer = 1.9; Int Health = 473; Int mind = 195; Int range = 625; Int Movement = 300; Int lossMin = 44; Int curetax = 55; }  

Am I here on the right track?

How can I choose for a character class once I make the class of each character?

As other people have recommended, you should probably read a book on OOP. However, in a nutshell:

The code provided by you creates two, completely unrelated types of objects, character and first character . However, it appears that what you really want to do is create an example of a class class, such as:

  character prefix = new character ();  

and then use the accessor methods or other methods to set the character properties. For example, if the fields were public (not recommended), then you could:

  Firstly.Strength = 17; First Search. Qualification = 26; ...  

You will need to reproduce these values ​​again when the level changes, for the way you try, you specify a formula for them. can not do.

Good luck!


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -