Game Development Community

Question about CompositeSprite(Isometric mode)..(Sloved)

by KevinYuen · in Torque 2D Beginner · 03/03/2013 (5:56 pm) · 5 replies

Tile size: 128X64

Script Code:
%composite = new CompositeSprite();
%composite.setDefaultSpriteStride( 4, 2 );
%composite.setDefaultSpriteSize( 8, 4 );
%composite.SetBatchLayout( "iso" );
%composite.SetBatchSortMode( "-y" );
%composite.SetBatchIsolated( CompositeSpriteToy.RenderIsolated );
for ( %y = -10; %y <= 10; %y++ )
{
for ( %x = -10; %x <= 10; %x++ )
{
%composite.addSprite( %x SPC %y );
%composite.setSpriteImage( "CompositeSpriteToy:tilecells", getRandom(0,4) );
}
}

Result: gaps between the blocks.
like this:
e.hiphotos.baidu.com/album/s%3D550%3Bq%3D90%3Bc%3Dxiangce%2C100%2C100/sign=808bcd02d31b0ef468e8985bedff20e7/7c1ed21b0ef41bd589276dd850da81cb39db3da1.jpg?referer=5d78ba49b219ebc4996f43a97b60&x=.jpg
My english is not good, forgive me. =(

#1
03/04/2013 (12:06 am)
I could give it a go if you could send just the toy that includes your code and image or perhaps just the image if the code you're using only consists of the above to melvm at garagegames {dot} com.
#2
03/04/2013 (1:10 am)
http://pan.baidu.com/share/link?shareid=343510&uk=607085369
i just modify CompositeSpriteToy, this is toy's zip.
#3
03/04/2013 (3:15 am)
I just looked at this for you and the reason why you're seeing the background is because your isometric tile asset is using the standard "bilinear" texture filtering which is causing texel bleeding.

You can turn this off either globally or on a per-asset basis as described in the documentation here.

To stop it I went to your "sand_tiles" asset and added the filter mode like this:
<ImageAsset
    AssetName="sand_tiles.asset"
	FilterMode="Nearest"
    ImageFile="sand_tiles.asset.png">
	<ImageAsset.Cells>
		<Cell Offset="2 2" Width="128" Height="64"/>
		<Cell Offset="262 134" Width="128" Height="64"/>
		<Cell Offset="132 134" Width="128" Height="64"/>
		<Cell Offset="2 266" Width="128" Height="64"/>
		<Cell Offset="2 200" Width="128" Height="64"/>
		<Cell Offset="2 134" Width="128" Height="64"/>
		<Cell Offset="262 68" Width="128" Height="64"/>
		<Cell Offset="132 68" Width="128" Height="64"/>
		<Cell Offset="2 68" Width="128" Height="64"/>
		<Cell Offset="262 2" Width="128" Height="64"/>
		<Cell Offset="132 2" Width="128" Height="64"/>		
	</ImageAsset.Cells>	
</ImageAsset>

As described in the doco though, you could also do this globally i.e. set the default like this somewhere at start-up:
$pref::T2D::imageAssetGlobalFilterMode = "Nearest";

Hope this helps.
#4
03/04/2013 (3:29 am)
thank for your help~ Melv =)

I will try to translate your document, so that our country's friends study T2D together~
#5
03/04/2013 (3:32 am)
You are most welcome.