File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Java Board Game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Java Board Game" Watch "Java Board Game" New topic
Author

Java Board Game

nul ks
Greenhorn

Joined: Mar 24, 2011
Posts: 3


the above code is the layout i've created for the board game. but im stuck .. on how to set the players .. and how the movement of the game for each player :x NEED URGENT HELP. thank you in advanced
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
the above code is the layout i've created for the board game.


The first thing you need to do is get rid of the 64 variables you used to create each label. This should be done in a loop and you can add each label to an array if you really think you need to keep track of them separately.

Fix this part of the code first (and repost the fixed code) before moving on to your next problems.

on how to set the players


Don't know what that means.

how the movement of the game for each player


Don't know what that means either. We have no idea what kind of game you are creating.

nul ks
Greenhorn

Joined: Mar 24, 2011
Posts: 3
the loop part, im working on it now.

im actually creating a board game more or less like the snake & ladder movement.

and as for the players, im thinking of giving choices on how many players are going to play ranging to maximum of four. each player will be set with a different colours for their movement on the board according to the value they get for rolling the dice
nul ks
Greenhorn

Joined: Mar 24, 2011
Posts: 3
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
each player will be set with a different colours


This would generally be done by creating an Icon to represent each player. Then you can add the Icon to the JLabel.

This approach works great for games like chess and checkers, where any given square can only have one playing piece. I'm not sure how you will do it in your game because its possible that a square could have multiple pieces depending on the roll of the dice.

So maybe what you need to do is use a JPanel to represent each piece of your game board. Then you can use the Overlap Layout as the layout manager for each panel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Board Game