Hi there!
I started today on making the building-system. But then I saw a problem I couldn’t fix (atleast with my “skills”). I thaught it would be very simple just like I did with the Strings:
private static String[] buttonName = {"Woodcutter", "Forester", "Sawmill", "Quarry", "Farm", "Mill", "Bakery", "Swine farm", "Butcher", "Fisherman"};
So I made this:
public static Entity holdingConstruction = null;
private static Entity[] buttonConstruction = {tree, cave /*NOTE: I used 2 entities as example*/};
and in the void where the clicking code is I used this:
holdingConstruction = buttonConstruction[i];
But when I try:
holdingConstruction = buttonConstruction[i];
System.out.println(holdingConstruction + ", " + i);
It will say: null, 0 (This should then not be null but tree, atleast that is what I think)
So I knew there was something wrong with this. I searched google and looked in the docs.oracle.com and didn’t saw a thing what I was doing wrong. So my question is: How can I fix this?
If you know how I can fix this, please do NOT give me the actual code. I am new to Java and still need to learn coding. By doing it myself I will learn more then I copy things!
Already thanks!
-RoseSlayer