Game Development Community

A simple question

by Christopher Hernandez · in Torque X 2D · 06/23/2007 (9:14 am) · 1 replies

Hey all.

I have an animated 2d sprite in TGXB that is just a simple countdown 10 - 0. I would like it so that you can control which frame the animation is on by the user simple pressing either the up or down arrows on the keyboard.

What needs to be done in C# so that the code I am writing recognizes the animated sprite in TGXB and can also control which frame of the animation it is currently on?

Do I need to give it an "object type" in TGXB, or does it need a "name" under scripting in order to refer to it in C# code?

#1
06/23/2007 (9:22 am)
There are several ways you could do it. You could create a component that gives you the functionality and attach it to the animated sprite in TXB. Or you could give the object a name in the scripting rollout and get a reference to it from the TorqueObjectDatabase. Have you done the tutorials? The Microbes tutorial focuses on creating components, and the Blaster tutorial focuses on accessing the TorqueObjectDatabase.