About create a CompositeSprite from a taml file...
by KevinYuen · in Torque 2D Beginner · 04/23/2013 (5:43 am) · 2 replies
The taml file is like this:
In my project:
Output in console:
Cannot select sprite name 'MainMarker' as it does not exist.
If i create a it in code directly, it work well.
<CompositeSprite
SceneLayer="1"
Awake="0"
BatchIsolated="1"
BatchSortMode="New"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="torque.xsd">
<CompositeSprite.Sprites>
<Sprite
Name="Ground"
Image="GoldenFlowerAssets:CardTemplate01"
Frame="0"
Position="0 0"
Size="15 20" />
<Sprite
Name="MainMarker"
Image="GoldenFlowerAssets:CardBigFlagFire"
Frame="0"
Position="0 0"
Size="10 15" />
</CompositeSprite.Sprites>
</CompositeSprite>In my project:
%object = TamlRead( "^MyProjectAssets/test.taml" );
Game.MainScene.add( %object );
%ret = %object.selectSpriteName( "MainMarker" );Output in console:
Cannot select sprite name 'MainMarker' as it does not exist.
If i create a it in code directly, it work well.
KevinYuen
// Did we get a sprite name? if ( spriteName != StringTable->EmptyString ) { // Yes, so insert into sprite names if it doesn't already exist. if ( mSpriteNames.find( spriteName ) != mSpriteNames.end() ) mSpriteNames.insert( spriteName, mSelectedSprite ); }modify....
// Did we get a sprite name? if ( spriteName != StringTable->EmptyString ) { // Yes, so insert into sprite names if it doesn't already exist. if ( mSpriteNames.find( spriteName ) == mSpriteNames.end() ) mSpriteNames.insert( spriteName, pSpriteBatchItem ); }It's a bug. please update git :)