Game Development Community

Image Mode: KEY

by Ray Graham · in Torque Game Builder · 01/17/2009 (12:03 am) · 8 replies

Hi guys,

I did some quick searching but couldn't find anything on this, so if anybody could point me in the right direction that would be awesome.

How do I use the KEY mode for image maps? What's the key need to be? Black pixels or something? (or am I assuming this means something else?) I have some cases where my sub-images in my textures aren't all the same size and I need to pack them tight.

Thanks!


#1
01/17/2009 (5:15 am)
The key can be any color that is not in the images in the file. Here's is a excerpt from a tutorial/book I'm writing...

"Each image in the image is in its own rectangle. All rectangles tops have to be aligned in each row. Rectangles can be the same size, but not bigger than the first one in each row. The first rectangle must be aligned to the left of the entire image with space between every image. In a key image map the pixel at the top left must be the color key. This means that between each image on all sides is filled with the key color. This is what the image looks like in full mode."

www.hobbygameprogramming.com/images/blocks.png
You can use png's that are transparent, but you will have to put each image in it's own rectangle.
#2
01/18/2009 (1:49 pm)
Ah, I get it. Thanks! Very helpful information Steven.
#3
11/11/2009 (10:18 pm)
@Steven,

I´ve followed the tutorial and I get a mess. Key Image seems really confusing and even more since i need to do with transparent png images. Can you be more specific on how to set a rectangle for a transparent image? Should the transparent area be also filled?

Thanks
#4
11/12/2009 (10:30 am)
Hi Issac, can you post your image so I can see what it looks like. you might have your key color in your image.

Basically what happens is the the image is scanned across until a pixel of the key color is found and the image width is set to that pixel -1. Then the image is scanned for legnth with the same process. Once the size of the image is found is is picked and saved. The process starts over from the last key pixel found. Images can be the same size, but not bigger than the first image. Make sure there is no key color down the left side of the image. Here's an example:

www.hobbygameprogramming.com/images/transparent.png
#5
11/12/2009 (11:55 am)
Hi Steven,

So in a transparent image you can do what you´re showing? Cool. I´ve read in the tutorial that you should use green and cyan pixels! Well, i don´t know how to upload an image -I don´t have a server-. Can I send a image to some adress?

I will try now again :)

Thanks!
#6
11/12/2009 (12:16 pm)
send it to my email
#7
11/12/2009 (1:24 pm)
@Steven,

That did the trick. And no extra pixels needed! Damn incomplete/partial tutorials!

Thanks!
#8
11/12/2009 (5:39 pm)
Hey what tutorial were you using?