Game Development Community

Creating image maps from surfaces

by Daniel McNeese · in Torque Game Builder · 07/10/2007 (4:08 pm) · 1 replies

Given a .png file, I've learned how to create and use a new image map in script. But I haven't found anything in the docs about creating drawing surfaces or creating new image maps from them.

How do I combine image maps I already have to form new ones during play?

#1
07/11/2007 (12:24 pm)
Daniel,

If you want to combine multiple image maps together to create one larger image map, look in the docs for the Linked Image Map functionality.

If the code examples are limited, you can always create them in the Editor and save the level, then look at the managed/datablocks.cs to see how the editor created the code to perform the task.

I believe it's more or less as simple as:

datablock ImageMap(ImageMap1)
{
  // details
};
datablock ImageMap(ImageMap2)
{
 // details
};
datablock LinkedImageMap(ImageMap3)
{
  imageMap1 = ImageMap1;
  imageMap2 = ImageMap2;
};

Now, thats pseudo-code cause I don't have TGB handy at the moment ... but try doing it in the editor and you'll see the exported TorqueScript in datablocks.cs, which you can mimic.


As far as creating datablocks dynamically through code, this is not really suggested unless you really know what your doing ...