Results 1 to 5 of 5
- 01-19-2009, 08:36 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
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". :)
- 01-20-2009, 03:13 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Do you want to use all values in an array to work with switch statement?
-
I don't really see a coherent question in your original post. What exactly are you having trouble with?
- 01-20-2009, 04:12 AM #4
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
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.
- 01-20-2009, 04:22 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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
-
Implementing "Game Over" in Minesweeper game based on Gridworld framework.
By JFlash in forum New To JavaReplies: 2Last Post: 08-05-2010, 04:49 AM -
beginner grade 11-need help with RaceCar Game
By bobmasta5 in forum New To JavaReplies: 0Last Post: 01-09-2009, 09:04 PM -
Beginning Game Development - Suggestions?
By JDCAce in forum Advanced JavaReplies: 1Last Post: 12-08-2008, 05:42 PM -
Basic Question from Networking Beginner
By JDCAce in forum NetworkingReplies: 7Last Post: 10-10-2008, 08:29 PM -
Global Thread - Game Development
By M77 in forum Suggestions & FeedbackReplies: 1Last Post: 06-29-2008, 04:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks