Okay, right before, you read the code its self i'm really new to this, even though i have a slight knowledge of java as a language i'm still getting a bit confused on whats the best way to do things...
Okay, i'm making a game... and on the game client i want it to print the following variables...
level xptnl workers coins
Okay, now at the moment i'm doing this straight from my GameLoader class which extends JFrame
Now i would prefer to load this information from my playerdata class instead of straight out of my Gameloader...
Heres what i have so far...
public void paint(Graphics g) { this.level = 0; this.xptnl = 0; this.workers = 0; this.coins = 50000; try { java.net.InetAddress i = java.net.InetAddress.getLocalHost(); String characterName = i.getHostName(); g.setColor(Color.lightGray); g.fillRect(0,0,600,400); g.setColor(Color.RED); g.drawString("Username: "+characterName+"", 7, 40); g.drawString("Level: "+level+"", 180, 40); g.drawString("Exp from "+level+1+ " is : "+xptnl, 250, 40); g.drawString("workers: "+workers, 370, 40); g.drawString("coin stack: "+coins, 450, 40); } catch(Exception e){e.printStackTrace();} }
To me this seems an extremely stupid way of doing it...
How would i load this information from my playerdata class?
Could i maybe use an object?