Game Development Community

Cloning T2DStaticSprite

by Ernesto Karren · in Torque X 2D · 07/30/2008 (12:31 am) · 1 replies

I want to clone T2DStaticSprite object basing on a material having image mode "cell".

I marked this object as template.

As soon as i use "Clone()" I get an assert failure when i start the game.

The failure says:
------------------------------------------------------------------------------------------------
T2DStaticSprite.CopyTo(TorqueObject obj) needs the following lines of code:

T2DStaticSprite obj2 = (T2DStaticSprite)obj;
obj2.MaterialRegionIndex = MaterialRegionIndex;
...
----------------------------------------------------------------------


The same thing is working as soon as i have image mode"FULL".

In easy words:

I have an object basing on a material with more sprites in it.
I clone it.
I get this message as soon as i run the code.

I change the material to a material which has only one sprite, it works

Thanks for any help.

#1
08/02/2008 (12:58 pm)
Quote:I have an object basing on a material with more sprites in it.

Therefore you have an animation and not a single sprite.
Try T2DAnimatedSprite.