Results 1 to 3 of 3
  1. #1
    Don k is offline Member
    Join Date
    Apr 2010
    Rep Power

    Default need help making a game board

    i need to make a game board, here are the specs:
    7. Board

    a. Properties

    i. private int rows

    ii. private int columns

    iii. board 2 dimensional array of Tile

    b. Methods

    i. Constructor that constructs the 2 dimensional array of Tile remember, creating the board does not create the Tiles by default. You need to instantiate them.

    ii. toString that outputs the board. Example:





    where _ is inaccessible, F is forest, W is Water, and G is grass

    8. GameTester tester class that creates a board and displays it.

    also i need to make a class called tile for the gameboard class:


    a. Properties

    i. Terrain surface

    b. Methods
    i. Tile(Terrain t) constructor that takes a Terrain object

    so far for my gameboard class i have:

    XML Code:
    public class Board
       private int rows; 
       private int columns;
       Tile[][] board; 
       public Board()
        Tile t = new Tile();
         String []Tile= 
         {  {_,_,_,f,f,w,w,f,f,g,g,_},
     public String toString()
          String result = "";
          return result;
    and for the tile class i have:
    XML Code:
    public class Tile
       Terrain surface; // the Terrain object representing the type of surface (forest, grass, water, etc.)
       Terrain water;
       Terrain forest;
       Terrain ground;
       Terrain inaccessible;
       // constructor
       public Tile(Terrain t)
          surface = t;
          water = w;
          forest = f;
          ground = g;
          inaccessible = _;
    please help i need to pass this class!!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    The Board constructor must instantiate the 2-D array of Tile objects. Yours doesn't do this but rather instantiates a single Tile object that you call t. This won't help you. Then you create a String array called Tile that you then throw out-- why? The instructions don't tell you to create a String array -- so don't do it. Instead your toString method needs to iterate through the 2-D Tile array and display the results based on what is held in this 2-D array.

  3. #3
    Don k is offline Member
    Join Date
    Apr 2010
    Rep Power


    how do i instantiate them into the array, i dont know where to even star. i cant find examples on how to dothis anywhere, all i need is an example onhowto instantiate one of the objects(grounf, forest etc.) and i would be able to do them all

Similar Threads

  1. Developing an Hex-board strategy game
    By abegade in forum Java 2D
    Replies: 8
    Last Post: 05-03-2011, 11:16 AM
  2. game board design
    By tomitu in forum New To Java
    Replies: 12
    Last Post: 02-27-2010, 05:31 PM
  3. Replies: 6
    Last Post: 12-15-2009, 02:33 AM
  4. need help with a simple game im making
    By frallan in forum AWT / Swing
    Replies: 2
    Last Post: 11-30-2009, 10:36 AM
  5. Programming a Board Game
    By makanti in forum New To Java
    Replies: 7
    Last Post: 03-10-2009, 02:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts