Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Board Game

 
nul ks
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rob Camick
Ranch Hand
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic