Game Development Community

Load Collisions, Load alpha

by TikGames LLC · in Torque Game Builder · 09/17/2009 (1:59 pm) · 5 replies


Hi there!

1) I am looking in TGB for posibility to load collisions from black-white image (not setting in collisions-editor, not any other cases) - just to set up collisions in a game by using an image file.
2) Is it possible to assign black-white image file to set transparent-areas for (e.g.) jpeg-picture ?

If someone was working with such stuff, please help me ; )

Thanks beforehand !

#1
09/18/2009 (6:15 am)
You're talking about per-pixel collisions. That currently is not available in any of the Torque2D engines. A few people have started working on implementing this, however a quick forum search hasn't found any successful attempts just yet. I don't think it would be too difficult to add to anyone who understood both the collision system and render methods (so if you have a shader guy on staff, they might be able to do it...)
#2
09/18/2009 (10:24 am)
As for keeping alpha channel in separate file just create:
* exampleImage.jpg
* exampleImage.alpha.jpg

Two important things:
* alpha jpg HAS TO be 8-bit grayscale
* you CAN NOT use extension in ImageMap definition - just "exampleImage"
#3
09/19/2009 (12:14 pm)
Thanks for help!
Ok, and if I want to load a map's part (for example 1024x1024)
map1_1.jpg
and I have alpha-image for it map1_1.alpha.jpg
How I can load this image without alpha using (on layer #31) and then to load the image with alpha (as overlay-layer (trees, clouds etc on layer #0)) ? : )
#4
09/19/2009 (1:41 pm)
I don't Believe that Torque2D supports doing exactly that method by default. Shouldn't be too hard to add it to the engine, though.
#5
09/19/2009 (2:58 pm)
yes, if to add fileCopy and fileDelete then it is possible to load without alpha first and then to rename files and load with alpha, it needs to make temp empty images thoughts, because torque remember file-system before game started : ) but it is not good way..