Game Development Community

Some template questions

by Ryan Roper · in Torque X 2D · 12/23/2008 (10:41 am) · 3 replies

I just started looking at TX again, and I was messing around with templates and ended up having some questions.

If I drag an image into TXB and it creates a material and then I drag that into the scene and mark it as a template. Then I create a linkpoint on it and drag a different material into the scene and mount it to the link point do I need to mark the second one as a template also? If I do and create a clone of the first one does it create a clone of the mounted template also?

Also, if I wanted a static sprite object with a link point and a T2DAnimatedSprite mounted to it is it best to do that in code or as a template?

For instance if I wanted to create a sprite of a platform or something and then link a animated sprite of a turret or something to it that chose the frame of animation to show based on how damaged it was. The reason for doing it that way so that I could mounted different types of turrets or whatever to the same base platform.

One thought I had was to create a base TorqueObject that I could programatically mount to a link point and giving it the option of showing a sprite. I'm not sure though whether it is best to create an instance of the sprite and mount it to the same link point or if there is another way of doing it.

If some of that isn't clear let me know and I'll try to clarify. I don't really have a firm idea on the type of game I'm trying to make yet, I'm trying to work out the way some of the pieces fit together first.

#1
12/24/2008 (12:53 pm)
This can be deleted or whatever, I've figured out an answer for some of my questions and figured out how to structure things to suit what I was doing I think.

Basically I have a T2DStaticSprite that I turned into a template that is a moveable platform that the player controls. On the platform I have linkpoints that designate the kind of equipment that is to be mounted to it. I did this by the naming of the linkpoints. Then I have a blank sprite object that I turned into a template that has components on it that tell it how to behave.

So I have a "heavy weapon" module and a "light weapon" module, etc. Then in the onregister of the platform I have it clone the appropriate module and mount it to the appropriate link point.

So where I left it last night is that I need to create a component that I can attach to the modules that provides event handling. That way I can have a standard way of activating the modules from the platform. Each module will register it's event handlers with the platforms handlers and each component on the module will register for the appropriate handlers to the platforms.

The only part I didn't nail down last night is how to iterate over the linkpoints attached to a sceneobject. It seems like Owner.LinkPoints would be like a list of linkpoints but it doesn't look like it from the intellisense. It looks like you have to call LinkPoints.GetLinkPoint which requires the name of the linkpoint and kind of eliminates the usefulness of iterating through them and setting up a platform dynamically.

Anyone have any thoughts?
#2
12/24/2008 (1:42 pm)
For the links points question. This should get you started in the right direction.
#3
12/24/2008 (2:00 pm)
Unfortunately that page seems like it's no longer available. I've been having that problem with TDN lately.