Jump to content

using tile maps

- - - - -

  • Please log in to reply
5 replies to this topic

#1
zapdude1234

zapdude1234

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
i have an tile map that i wanted to grab a specific tile from. Is there a way to grab only a section of an Image?

#2
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
The BufferedImage class has a method called "subImage" that returns a new BufferedImage from the selected region.

BufferedImage (Java Platform SE 6)

#3
zapdude1234

zapdude1234

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
awesome! do you know how to load a picture to the BufferedImage?

#4
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
Using ImageIO ImageIO (Java Platform SE 6)


BufferedImage sprite = ImageIO.read( new File("directory/of/file/spriteSheet.png") );



#5
zapdude1234

zapdude1234

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
alright. would it be best to use a tilesheet and to grab subimages off it or would it be best to just individually create each tile?

#6
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP

zapdude1234 said:

alright. would it be best to use a tilesheet and to grab subimages off it or would it be best to just individually create each tile?

It's probably more efficient to use sub images, but I enjoy/find it easier creating individual images.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users