Jump to content
  • Advertisement
Sign in to follow this  
prof_89

using tilesets in java/applet

This topic is 4317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi... We are making an game and for the moment we have lots of images.. we want a new file "tiles.java"... in it we want to make the different tiles from an tileset.. how do i make an image from a part of the tileset??

Share this post


Link to post
Share on other sites
Advertisement
I not sure what exactly you are trying to do.

Do you want to create a single image that is built from different tiles (each one in a file)? If so, use Java's rendering functionality to draw an image to a certain rect of another image.

If you want to extract multiple tile images from a single tileset image, you the other way round: draw a rect of the tileset to a new tile image. You need to know where your tiles are located, e.g. 4 by 4 tiles, each tile is 1/4 of the width and height of the tileset image. Tile 6 (zero-based) would then start (upper left corner) at 1/4 of the height and 2/4 of the width of the tileset.

Share this post


Link to post
Share on other sites
Use BufferedImage.

Create a BufferedImage for your tileset (named imgTileSet for example) then call imgTileSet.getSubimage(x, y, width, height). This creates a new BufferedImage for your tile.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!