Okay so right now I am working on my 2nd program yet. I just started Java a few days ago and programming--overall-- for only a week, so a lot of information is very foreign to me.
What I've been doing is following some basic tutorials, and with each section I learn, I will make my own program to test my own abilities and understanding.
This means that I am trying to work out the problems of the programs i want to make with less resources (since I have not covered many topics yet)
I am now working on a very minor card game. (It will simply be executed in the play function of Eclipse. There will be no special graphics or anything)
What I thought would be a good idea was to create a class for the characteristics required of each card:
package cardGame; public class cards { String name; int traitBarrier; String traitCardType; int cardNumber; public void setName(String n){ name = n; } public String getName(){ return name; } public void setTraitBarrier(int b){ traitBarrier = b; } public int getTraitBarrier(){ return traitBarrier; } public void setCardNumber(int c){ cardNumber = c; } public int getCardNumber(){ return cardNumber; } public void setTraitCardType(String t){ traitCardType = t; } public String getTraitCardType(){ return traitCardType; } }
Then I created another class to database all the created cards(referencing the previous class):
package cardGame; public class cardLibrary { public static void main(String[] args) { cards card1 = new cards(); cards card2 = new cards(); cards card3 = new cards(); cards card4 = new cards(); cards card5 = new cards(); cards card6 = new cards(); cards card7 = new cards(); cards card8 = new cards(); cards card9 = new cards(); cards card10 = new cards(); card1.name = "Flames Elemental"; card1.cardNumber = 1; card1.traitCardType = "Fr"; card1.traitBarrier = 3; card2.name = "Earth Elemental"; card2.cardNumber = 2; card2.traitCardType = "Ert"; card2.traitBarrier = 5; card3.name = "Aquatic Necromancer"; card3.cardNumber = 3; card3.traitCardType = "Wtr"; card3.traitBarrier = 4; card4.name = "Soul Hunter"; card4.cardNumber = 4; card4.traitCardType = "Dk"; card4.traitBarrier = 4; card5.name = "Crusading Monk"; card5.cardNumber = 5; card5.traitCardType = "Lit"; card5.traitBarrier = 6; card6.name = "Explosion Vigilante"; card6.cardNumber = 6; card6.traitCardType = "Fr"; card6.traitBarrier = 2; card7.name = "Gate Keeper"; card7.cardNumber = 7; card7.traitCardType = "Ert"; card7.traitBarrier = 8; card8.name = "Priestess of the Lake"; card8.cardNumber = 8; card8.traitCardType = "Wtr"; card8.traitBarrier = 3; card9.name = "Jr. Assailant"; card9.cardNumber = 9; card9.traitCardType = "Dk"; card9.traitBarrier = 1; card10.name = "Divine Alchemist"; card10.cardNumber = 10; card10.traitCardType = "Lit"; card10.traitBarrier = 3; } }
Finally in my main class…
I seem to be confused on how exactly I can call the cards from my cardsLibrary class into my main class to create the deck.
Did I skip some steps that were required for me to be able to do this?