I've got a game, and I'm trying to do it right. I've got a spritesheet (which is really just a class that loads images for easy access. It seems to work, but then my tile system starts, and it fails in an interesting way - it loads only the foreground, and displays only that color for all 1024 pixels for each tile. I've no idea what could possibly be going wrong. I've tried using the ImageIO class's read method, and a more unorthodox way (using an ImageIcon's getImage method). The source is attached below in a zip.


I tried to read the code in your zip file, but the lack of documenation/comments/good variable names made that very hard. What I couldn't find was where you override paintComponent for your main frame or panel. I saw all kinds of graphics objects and paint methods, but if they don't fit 100% into the standard Swing way of doing things they're simply not going to work.

I found the problem. It was that I was assigning each tile a x,y that was too small. Also, I was making too many tiles.

This question has already been answered. Start a new discussion instead.