Distinction between T2DSceneObject and T2DStaticSprite
by Kareem Glover · in Torque X 2D · 11/04/2009 (6:46 pm) · 1 replies
I am trying to clarify the difference between a defining a T2DSceneObject and a T2DStaticSprite. My head logic is that I would create a SceneObject and then define the image or "material"; that alas is not the case.
In my review I am seeing where a StaticSprite is defined and assigned a texture.
What I need to understand is in relation to a progam what would a SceneObject be used for.
Regards,
-Kareem
In my review I am seeing where a StaticSprite is defined and assigned a texture.
What I need to understand is in relation to a progam what would a SceneObject be used for.
Regards,
-Kareem
Torque Owner Duncan Colvin
T2DSceneObject does not know about textures, it just knows about being a scene object, but not any partcular kind of scene object. So you need to use a T2DStaticSprite if you want to assign a texture. Or a T2DAnimatedSprite if you want to assign an animation. And so on.
When would you want to reference a T2DSceneObject in a program? Well sometimes in your program you might not know if an object is a static sprite or an animated sprite, but you know that static sprites and animated sprites are ultimately both scene objects. So if you want to do something simple like setting Visible to true or false, or setting the object's Position or Size, then you can just treat the object as a T2DSceneObject and not worry about what particular kind of scene object it is at a higher level.