[java] Map drawing problem?
http://www.geocities.com/opv99/problem.zip
Problem is in here, in that algo in Engine.java/drawmap.
//For each tile in row
for(j=0;j 31)
tx = 0;
if((ty-=1) < 0)
ty = 31;
}//for each tile in row
screeny+=32;
if((i & 1) == 1)
{
if((mx+=1) > 31)
mx = 32;
} else
{
if((my+=1) > 31)
my = 32;
}
I''m compeletely out of answers and questions, too(?). So if you know way to make em'' draw just like they are presented in array OR way to change the drawing algo so that It draws them right, reply, please.
Time comes, time goes and I only am.
GoDEngine intialized
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:106)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:115)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
ava:255)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:221)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:189)
I did ">java rpg", is that right? Why are you getting images with URLs? I tried running a web server on my comp to see if "localhost" was hardcoded in there somewhere, but nope.
Okay, got it, i had to put the images under an images dir
Edited by - Jim_Ross on 5/1/00 9:44:29 AM
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:106)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:115)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
ava:255)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:221)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:189)
I did ">java rpg", is that right? Why are you getting images with URLs? I tried running a web server on my comp to see if "localhost" was hardcoded in there somewhere, but nope.
Okay, got it, i had to put the images under an images dir
Edited by - Jim_Ross on 5/1/00 9:44:29 AM
Winzip was supposed to do that, I mean put images under images dir.
It seems to be that getClass().getResource(); does it automatically? Well, anyhow, then how should I do it? With quick review I couldn''t find better way to do, but it''s not the most important thing in this case. Still, why is it drawing it wrong?
Time comes, time goes and I only am.
It seems to be that getClass().getResource(); does it automatically? Well, anyhow, then how should I do it? With quick review I couldn''t find better way to do, but it''s not the most important thing in this case. Still, why is it drawing it wrong?
Time comes, time goes and I only am.
One problem is that when you're drawing the tiles in a cell in drawMap, in your "k" loop
for(k=0;k < map[ty][tx].num;k++)
{
tile_to_draw = map[ty][tx].tile[k];
offScreen.drawImage(grassTiles[tile_to_draw], screenx, screeny, this);
}//for each tile
If you look up in loadMap, you set map[][].num for the various cell types, but you only ever assign one tile to be drawn. For example, in loadMap for a tile of type 5, you set map[_i][j].num to 2, but you only define map[_i][j].tile[0], so I'm surprised you're not getting errors in the for k loop in drawMap.
Also, what's the while loop for in drawMap?
Edited by - SteveMeister on 5/1/00 12:55:35 PM
for(k=0;k < map[ty][tx].num;k++)
{
tile_to_draw = map[ty][tx].tile[k];
offScreen.drawImage(grassTiles[tile_to_draw], screenx, screeny, this);
}//for each tile
If you look up in loadMap, you set map[][].num for the various cell types, but you only ever assign one tile to be drawn. For example, in loadMap for a tile of type 5, you set map[_i][j].num to 2, but you only define map[_i][j].tile[0], so I'm surprised you're not getting errors in the for k loop in drawMap.
Also, what's the while loop for in drawMap?
Edited by - SteveMeister on 5/1/00 12:55:35 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement