Results 1 to 5 of 5
  1. #1
    codermom is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Cool Beginner at very basic game development

    Can I get some tips regarding a project I am trying to complete?

    //Shelly Hodge
    //Java II
    //Map Exercise
    //January 16th 2009


    import java.util.*;
    import java.io.*;

    public class MapGame
    {
    static Scanner console = new Scanner(System.in);

    public static void main(String[] args)
    {
    int[][]Map = new int [4][3]; //make map

    int intx;
    int inty;
    int xpos;
    int ypos;
    int intCounter;

    for (intx = 0; intx <=3; intx++); //sets elements
    for(inty = 0; inty <=2; inty++);
    Map[intx][inty] = 0;

    Map[1][1] = 3; //sets initial pos

    do while(intCounter>=100);

    int move = console.nextInt()
    switch(move) {

    case 1:
    intx--; //subtract one above
    case 2:
    intx++; //adds one below
    case 3:
    inty--; //subtracts from side
    case 4:
    intx++; //add from side
    }

    intCounter++;

    }
    }




    thats my code. I need to display the map ans loop the swith statement. It is assumed that the number 3 is a ship and 0 = water. I need to display the map accordingly and then prompt user for input to move the "ship". :)

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I don't really see a coherent question in your original post. What exactly are you having trouble with?

  4. #4
    codermom is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default

    I have compiled and ran the app but it does not display the "map". How do I achieve that? I need to loop the users prompt and movement choices. How do I acieve that?
    Sorry it wasn't clear b4.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    You have to loop the complete array, something like this.

    Java Code:
    for(int i = 0; i < ROWS; i++) {
       for(int j = 0; j < COLUMNS; j++) {
           // print map[i][j] here
       }
    }

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2010, 04:49 AM
  2. beginner grade 11-need help with RaceCar Game
    By bobmasta5 in forum New To Java
    Replies: 0
    Last Post: 01-09-2009, 09:04 PM
  3. Beginning Game Development - Suggestions?
    By JDCAce in forum Advanced Java
    Replies: 1
    Last Post: 12-08-2008, 05:42 PM
  4. Basic Question from Networking Beginner
    By JDCAce in forum Networking
    Replies: 7
    Last Post: 10-10-2008, 08:29 PM
  5. Global Thread - Game Development
    By M77 in forum Suggestions & Feedback
    Replies: 1
    Last Post: 06-29-2008, 04:47 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
  •