• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Board Game

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic