1 Attachment(s)
Why doesnt this logical tile loading system not work as I a begginer expect it to and many others for that matter?
Hello This is for a Java game
Why does this system only draw portions of tiles, it looks as if it only ever iterates a couple times
and doesn't iterate to load the entire map even though my txt file images\map.txt has something like.
1 1 1 1 1 1 1 2 2 2 1 1 3 4 1 1 1 1 2 3 ect.
please take a look at the sample.jpg I,ve attached.
I don't understand Ive spent a couple days now trying to load a full map.
This is my method of loading a java game map at run time.
Please help Thankyou.
Code :
private void load() throws FileNotFoundException
{
Scanner coords_scanner = new Scanner(new File("txt\\hud_map.txt")) ;
while(coords_scanner.hasNextInt())
{
int i = 0 ;
for(i = 0; i < 100; i++)
{
switch(coords_scanner.nextInt())
{
case 1 :
draw_x_coords[i] += 70 ; // horizontal tile
break ;
case 2 :
draw_y_coords[i] += 70 ; // vertical tile
break ;
case 3 :
draw_x_coords[i] += 140 ; // horizontal space
break ;
case 4 :
draw_y_coords[i] += 140 ; // veritcal space
break ;
}
}
}
}
Code :
for(int i = 0; i < draw_x_coords.length ; i++)
{
g2d.drawImage(METAL_TILE,draw_x_coords[i],draw_y_coords[i],70,70,null) ;
}
Re: Why doesnt this logical tile loading system not work as I a begginer expect it to and many others for that matter?
Can you post a small complete program the compiles, executes and shows the problem?
Its not possible to test the small pieces of code that was posted.