Get Cell Image
by yurembo · in Torque 2D Beginner · 02/06/2015 (4:18 am) · 4 replies
Hello all!
I have splitted an image by using TAML cod:
<ImageAsset
AssetName="..."
ImageFile="...">
<ImageAsset.Cells>
<Cell Offset="0 0" Width="40" Height="40" RegionName="tube"/>
<Cell Offset="0 81" Width="40" Height="40" RegionName="corner"/>
</ImageAsset.Cells>
</ImageAsset>
And funcs liks getExplicitCellWidth and getExplicitCellCount work correct. I get true results.
But I'm wonder how to get cell image?
There is a func getCellByName, but it's cannot be used from script, and how it use from script?
I have splitted an image by using TAML cod:
<ImageAsset
AssetName="..."
ImageFile="...">
<ImageAsset.Cells>
<Cell Offset="0 0" Width="40" Height="40" RegionName="tube"/>
<Cell Offset="0 81" Width="40" Height="40" RegionName="corner"/>
</ImageAsset.Cells>
</ImageAsset>
And funcs liks getExplicitCellWidth and getExplicitCellCount work correct. I get true results.
But I'm wonder how to get cell image?
There is a func getCellByName, but it's cannot be used from script, and how it use from script?
About the author
Torque fan
#2
02/06/2015 (5:25 am)
You can use getExplicitCellName, that is available to ImageAssets via script.
#3
%pic = %asset.getExplicitCellName(1);
%sprite.image = %pic;
Torque says: Asset Manager: Failed to acquire asset Id 'corner' as it does not exist.
02/06/2015 (5:57 am)
When I call: %pic = %asset.getExplicitCellName(1);
%sprite.image = %pic;
Torque says: Asset Manager: Failed to acquire asset Id 'corner' as it does not exist.
#4
02/06/2015 (6:15 am)
AnimationAsset works fine
yurembo