- 
	
	
	
		game library advice 
		Do you think I'm off to a good start? This is only one class that is half done btw.
 
 
	Code: 
 
 /**
 *
 * @author Erica Boyer
 * @datecreated 19 Mar 2009
 * @lastupdate 15 May 2009
 *
 * This is the class for an rpg character. It can be used for the user's players,
 * npc's, and  enemies. Basically, it just sets the player up with basic stats,
 * job (optional), gender, and such.
 *
 * >>To be converted to C++ later.
 *
 *
 */
 public class Player {
 
 public enum Job {WARRIOR, KNIGHT, BMAGE, WMAGE}
 public enum Status {NORMAL, KO, POISON, SLEEP, PETRIFIED, CURSED}
 public enum Gender {MALE, FEMALE}
 
 private final int initHp = 25;                      //Initial hit points
 private final int initMp = 10;                      //Initial magic points
 private final int initXp = 0;                       //Initial experience
 private final int initLvl = 1;                      //Initial level
 private final int initMaleStr = 4;                  //Initial male strength
 private final int initFemaleStr = 3;                //Initial female strength
 private final int initMaleEnd = 3;                  //Initial male endurance
 private final int initFemaleEnd = 2;                //Initial female endurance
 private final int initMaleDex = 2;                  //Initial male dexerity
 private final int initFemaleDex = 4;                //Initial female dexerity
 private final int initLuck = 2;                     //They start out the same luck
 
 private final int lvlUpHp = 5;                      //Amount of hit points gained every level up
 private final int lvlUpMp = 3;                      //Amount of magic points gained every level up
 private final int lvlUpStat = 1;                    //Amount of str, end, dex, and luck gained every level up
 
 private int jLvl;                                   //Holds the level of the jobs held by the character
 private int jStr;                                   //Holds the stegth the class gives initially
 private int jEnd;                                   //Holds the endurance the class gives initially
 private int jDex;                                   //Holds the dexterity the class gives initially
 private int jLuck;                                  //Holds the luck the class gives initially
 
 private String name;                                //Holds the characters name
 private Gender gender;                              //Holds the characters gender
 private Job job;                                    //Holds the characters job
 private int hp;                                     //Holds the characters hit points
 private int mp;                                     //Holds the characters magic points
 private long xp;                                    //Holds the characters experience points
 private int lvl;                                    //Holds the characters level
 private int str;                                    //Holds the characters strength
 private int end;                                    //Holds the characters endurance
 private int dex;                                    //Holds the characters dexterity
 private int luck;
 private Status status;
 
 //Player[] heroList = new Player[4];
 /**No-Arg Constructor Player
 *
 * Sets up all the stats the the character will need.
 *
 * @param none
 *
 */
 public Player() {
 
 setName("New Character");
 setJob(job);                    //need to get Job from chooser or other class
 
 setHp(initHp);
 setMp(initMp);
 setXp(initXp);
 setLvl(initLvl);
 
 if (gender.equals(0)) {
 setStr(initMaleStr);
 } else if (gender.equals(1)) {
 setStr(initFemaleStr);
 }
 
 if (gender.equals(0)) {
 setEnd(initMaleEnd);
 } else if (gender.equals(1)) {
 setEnd(initFemaleEnd);
 }
 
 if (gender.equals(0)) {
 setDex(initMaleDex);
 } else if (gender.equals(1)) {
 setDex(initFemaleDex);
 }
 
 if (gender.equals(0)) {
 setLuck(initLuck);
 } else if (gender.equals(1)) {
 setLuck(initLuck);
 }
 
 setStatus(status);
 
 //INCOMPLETE!!!!!!!!!!!!
 
 }//End constructor
 
 /** Level Defined Constructor
 *
 * Sets the stats up according to the level given
 *
 * @param lvl The level of the character created
 *
 */
 public Player(int lvl) {
 
 setHp(initHp + lvl * lvlUpHp * end);
 setMp(initMp + lvl * lvlUpMp * str);
 
 if (gender.equals("male")) {
 setStr(initMaleStr + lvl * lvlUpStat);
 } else if (gender.equals("female")) {
 setStr(initFemaleStr + lvl * lvlUpStat);
 }
 
 if (gender.equals("male")) {
 setEnd(initMaleEnd + lvl * lvlUpStat);
 } else if (gender.equals("female")) {
 setEnd(initFemaleEnd + lvl * lvlUpStat);
 }
 
 if (gender.equals("male")) {
 setDex(initMaleDex + lvl * lvlUpStat);
 } else if (gender.equals("female")) {
 setDex(initFemaleDex + lvl * lvlUpStat);
 }
 
 if (gender.equals("male")) {
 setLuck(initLuck + lvl * lvlUpStat);
 } else if (gender.equals("female")) {
 setLuck(initLuck + lvl * lvlUpStat);
 }
 
 
 }
 
 /** setName method
 *
 * Sets the name of the character
 *
 * @param name Holds the String with the characters name
 *
 */
 public void setName(String name) {
 
 this.name = name;
 
 }//End setName
 
 /** getName method
 *
 * Returns the name of the character
 *
 * @return name
 */
 public String getName() {
 
 return (name);
 
 }//End getName
 
 /** setGender method
 *
 * Sets the gender of the character
 *
 * Pre-Conditon: Has to be either male or female. If using a weird
 * race with 3 genders, this class doesn't support it. lol.
 *
 * @param gender
 */
 public void setGender(Gender gender) {
 
 this.gender = gender;
 
 }//End setGender
 
 /** getGender method
 *
 * Returns the gender of the character
 *
 * @return gender
 */
 public Gender getGender() {
 
 return (gender);
 
 }//End getGender
 
 /** setHp method
 *
 * Sets the hit points of the character
 *
 * @param hp Holds the hit points
 */
 public void setHp(int hp) {
 
 this.hp = hp;
 this.hp = this.hp + end;
 
 }//End setHp
 
 /** getHp method
 *
 * Returns the hit points of the character
 *
 * @return hp
 */
 public int getHp() {
 
 return (hp);
 
 }//End getHp
 
 /** setMp method
 *
 * Sets the magic points of the character
 *
 * @param mp Holds the magic points of the character
 */
 public void setMp(int mp) {
 
 this.mp = mp;
 
 }//End setMp
 
 /** getMp method
 *
 * Returns the magic points of the character
 *
 * @return mp
 */
 public int getMp() {
 
 return (mp);
 
 }//End getMp
 
 /** setXp method
 *
 * Sets the experience points of the character
 *
 * @param xp Holds the experience points of the character
 */
 public void setXp(long xp) {
 
 this.xp = xp;
 
 }//End setXp
 
 /** getXp method
 *
 * Returns the experience points of the character
 *
 * @return xp
 */
 public long getXp() {
 
 return (xp);
 
 }//End getXp
 
 /** setLvl method
 *
 * Sets the level of the character
 *
 * @param lvl Holds the level of the character
 */
 public void setLvl(int lvl) {
 
 this.lvl = lvl;
 
 }//End setLvl
 
 /** getLvl method
 *
 * Returns the level of the character
 *
 * @return lvl
 */
 public int getLvl() {
 
 return (lvl);
 
 }//End getLvl
 
 /** setStr method
 *
 * Sets the strength of the character
 *
 * @param str Holds the strength of the character
 */
 public void setStr(int str) {
 
 this.str = str;
 
 }//End setStr
 
 /** getStr method
 *
 * Returns the strength of the character
 *
 * @return str
 */
 public int getStr() {
 
 return (str);
 
 }//End getStr
 
 /** setEnd method
 *
 * Sets the endurance of the character
 *
 * @param end Holds the endurance of the character
 */
 public void setEnd(int end) {
 
 this.end = end;
 
 }//End setEnd
 
 /** getEnd method
 *
 * Returns the endurance of the character
 *
 * @return end
 */
 public int getEnd() {
 
 return (end);
 
 }//End getEnd
 
 /** setDex method
 *
 * Sets the dexterity of the character
 *
 * @param deex Holds the dexterity of the character
 */
 public void setDex(int dex) {
 
 this.dex = dex;
 
 }//End setDex
 
 /** getDex method
 *
 * Returns the dexterity of the character
 *
 * @return dex
 */
 public int getDex() {
 
 return (dex);
 
 }//End getDex
 
 /** setLuck method
 *
 * Sets the luck of the character
 *
 * @param luck Holds the luck of the character
 */
 public void setLuck(int luck) {
 
 this.luck = luck;
 
 }//End setLuck
 
 /** getLuck method
 *
 * Returns the luck of the character
 *
 * @return luck
 */
 public int getLuck() {
 
 return (luck);
 
 }//End getLuck
 
 /** lvlUp method
 *
 * Updates the status of the character when s/he levels up
 *
 */
 public void lvlUp() {
 
 hp = hp + lvlUpHp;
 mp = mp + lvlUpMp;
 str = str + lvlUpStat;
 end = end + lvlUpStat;
 dex = dex + lvlUpStat;
 luck = luck + lvlUpStat;
 
 lvl = lvl + 1;
 
 }//End lvlUp
 
 /** setStatus method
 *
 * Sets the status of the character
 *
 * @param status Holds the status of the character
 */
 public void setStatus(Status status) {
 
 //this.status = status;
 
 switch (status) {
 
 case NORMAL: {
 }//End normal case
 
 case KO: {
 }//End ko case
 
 case POISON: {
 }//End poison case
 
 case SLEEP: {
 }//End sleep case
 
 case PETRIFIED: {
 }//End petrified case
 
 case CURSED: {
 }//End cursed case
 
 default: {
 }//End default
 
 }//End switch
 
 }//End setStatus
 
 /** getStatus method
 *
 * Returns the status of the character
 *
 * @return status
 */
 public Status getStatus() {
 
 return (status);
 
 }//End getStatus
 
 /** setJob method
 *
 * Sets the job/class of the character
 *
 * @param job Holds the job/class of the character
 */
 private void setJob(Job job) {
 
 //this.job = job;
 
 
 switch (job) {
 
 case WARRIOR: {
 //jStr = ;
 }//End WARRIOR case
 
 case KNIGHT: {
 }//End KNIGHT case
 
 case BMAGE: {
 }//End BMAGE case
 
 case WMAGE: {
 }//End WMAGE case
 
 default: {
 }//End default
 
 }//End switch
 
 }//End setJob method
 }//End Player class
 
 
 
 
- 
	
	
	
	
		You're setting yourself up for a lot of writing this way. I suggest a loop where you generalize most of the writing and use a list that holds most of the different things.
 
 I only know python script, so bear with me.
 
 Like:
 
 character = [] #list of attributes of character
 count=character.count() #amount of attributes
 
 for x in range(0, count):
 n = attrlist.index(x)  #searches attr in a list
 m = ['initMale', 'n']
 attr = "".join(m)
 
 if (gender.equals("male")) {
 setEnd(attr + lvl * lvlUpStat);
 
 Etc etc, you get my drift. As my programming teacher used to say: "If it takes up more than a page of coding, (redo it) make it shorter with smart programming.
 
 
- 
	
	
	
	
		This is going to be a super duper class that handles a lot of :bou::bou::bou::bou:. Java is for uber-coding fans, like me. LOL!!! I like to spell everything out the long way. Once I get done with everything I have in mind I might compress it and make it more efficient. <3 
 
- 
	
	
	
	
		You'd think uber-coding fans would want to do it smart, not long. ;)
 
 Or your super duper class will be a super slow class.
 
 
- 
	
	
	
	
		Like I said, once I'm done with most of it I will compress it. :p 
 
- 
	
	
	
	
		I usually have layered coding, so if I have to compress it in the end, I might as well rewrite it.
 
 But whatever works for you, good luck.
 
 
- 
	
	
	
	
		Thanks, sir. I thought you said you didn't program? You lied to me!!! :mad2: