how would u go about in an easy way of getting integers from different classes?
i have a score int in each of my 5 ghost classes and i want to find the total of all 5 int's as its own integer in the player class. Right now i have something like this in the player class but it cannot find the variables in the for loops...
the code doesnt have to be in this format, i just tried this cause i thought it would work. I just need something that works with getting the playerScore's into one int.
private Ghost addScores() { for (Object obj : getWorld().getObjects(Ghost1.class)) { Ghost1 a = (Ghost1) obj; int ga = a.playerScore; } for (Object obj : getWorld().getObjects(Ghost2.class)) { Ghost2 b = (Ghost2) obj; int gb = b.playerScore; } for (Object obj : getWorld().getObjects(Ghost3.class)) { Ghost3 c = (Ghost3) obj; int gc = c.playerScore; } for (Object obj : getWorld().getObjects(Ghost4.class)) { Ghost4 d = (Ghost4) obj; int gd = d.playerScore; } for (Object obj : getWorld().getObjects(Ghost5.class)) { Ghost5 e = (Ghost5) obj; int ge = e.playerScore; } ghostScores=ga.playerScore+gb.playerScore+gc.playerScore+gd.playerScore+ge.playerScore; return null; }