Game Development Community

Creating own TorqueObjects and adding them to TXB

by Dennis Sasse · in Torque X 2D · 07/26/2007 (5:48 am) · 2 replies

Hi Community,

i need a T2DSceneObject with some special functionalities that can be placed/manipulated in TXB but is not drawn in the game. I could just use a Blank Scene Object and then add Components for the functionality, but since i am developing the tools/components/scene objects that are used by other members of my team, i would prefer a single Scene Object that has all needed functionality already included. This way other people using the component wouldn't need to add any components to it and could just manipulate it's properties directly - like with the Spawner Objects.

Now i have two questions:

1) Is this a good idea after all? Is it advised to create my own Torque Objects for some special functionality, or is it better to just write Components and add them to existing Scene Objects? I have the functionality already implemented as Component, but i would really like to get rid of this one (in my regard) unnecessary step of adding a Blank Scene Object whose only purpose is to act as "container" for my Component.

2) If i would write my own T2DSceneObject, is there a way to make it appear in TXB, just as the Spawner Object and the Blank Scene Object? So far i have not found any documentation on this.

About the author

Recent Threads


#1
07/27/2007 (1:00 pm)
@Dennis - Generally, using components is the preferred solution, and is why we went to so much trouble to make tweaking the properties of components easy in TXB. The programming model we recommend is to think of an "object" in your game as a collection of components. It's an "aggregation" approach to object oriented programming rather than a hierarchical inheritance approach.
#2
07/28/2007 (5:23 am)
@Dan - Thank you for your reply! I figured that using components is the preferred way to go. I just wasn't sure to what extent and when it would make sense to think about creating own objects. After playing around some more with components and getting used to the idea of aggregation, i will keep using components.

After all, it seems to be a rather intelligent and powerful approach ;)