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.

Thanks,
Jack

Could you post the code here on the forum that you are asking questions about?

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.

The paint override is in the Game.java file. I'll document the code more, then re-upload it.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.