Accessing Cells in an image
by Charles "monkeyboy" Gibson · in Torque Game Builder · 03/24/2005 (7:17 am) · 4 replies
Hi, I have a question regarding how to access a cell from an image map in code.
Let me explain what I am doing. I am creating a demo game (breakout clone) to learn the basics of T2D. I included 5 blocks into one image file stacked vertically of different color. I did this so I didn't have to create 5 separate image files for each block.
What I want to do is access one block from the image file. For example access the first block to use it to draw the first row of blocks, then the second block to do the next row, and so on.
First I setup the image map datablock. Here is how I did it:
datablock fxImageMapDatablock2D( block )
{
mode = cell;
textureName = "blocks.png"
cellWidth = "80";
cellHeight = "30";
cellCountX = "1";
cellCountY = "5";
};
From this point, I don't how to access the blocks individually. If anyone could help or even point me in the right direction to figure it out myself it would be appreciated. Thanks in advance for any assistance provided.
Let me explain what I am doing. I am creating a demo game (breakout clone) to learn the basics of T2D. I included 5 blocks into one image file stacked vertically of different color. I did this so I didn't have to create 5 separate image files for each block.
What I want to do is access one block from the image file. For example access the first block to use it to draw the first row of blocks, then the second block to do the next row, and so on.
First I setup the image map datablock. Here is how I did it:
datablock fxImageMapDatablock2D( block )
{
mode = cell;
textureName = "blocks.png"
cellWidth = "80";
cellHeight = "30";
cellCountX = "1";
cellCountY = "5";
};
From this point, I don't how to access the blocks individually. If anyone could help or even point me in the right direction to figure it out myself it would be appreciated. Thanks in advance for any assistance provided.
Torque 3D Owner Matthew Langley
Torque
.setImageMap(block);
add the frame number
.setImageMap(block, 0);