I have an integer "score" defined in the class Player. How do I get this integer in another class?


1 2 3 4 | public int getScore() { return score; } |
1 2 3 4 5 | //in an Actor subclass in the same world int playerScore = ((Player)(getWorld().getObjects(Player. class ).get( 0 )).getScore(); //in the World subclass in which the player is in int playerScore = ((Player)(getObjects(Player. class ).get( 0 )).getScore(); |
1 2 3 4 | public int getScore() { return score; } |
1 2 | //in an Actor subclass in the same world int playerScore = ((Player)(getWorld().getObjects(Player. class ).get( 0 )).getScore(); |
1 2 | //in the World subclass in which the player is in int playerScore = ((Player)(getObjects(Player. class ).get( 0 )).getScore(); |