Delegates and T2DTriggerComponent
by Tim Newsome-Ward · in Torque X 2D · 10/12/2010 (7:31 pm) · 21 replies
What would be the best way to draw animated sprites/Images to the screen? Kind of like a active HUD, feedback for the player.
I want to be able to add an animation which will fade in out i.e. "Level 1" and some other things such as a checkpoint marker.
Should I do this with a new GUI? Add the separate elements in there and then use the delegate to activate them? For some reason I just can't grasp this lol! Too many late nights me thinks... :-s
I'm thinking this would be a nice tutorial which I will write up.
So far I have this snippet from Aaron from an earlier thred:
Thanks
I want to be able to add an animation which will fade in out i.e. "Level 1" and some other things such as a checkpoint marker.
Should I do this with a new GUI? Add the separate elements in there and then use the delegate to activate them? For some reason I just can't grasp this lol! Too many late nights me thinks... :-s
I'm thinking this would be a nice tutorial which I will write up.
So far I have this snippet from Aaron from an earlier thred:
[TorqueXmlSchemaType]
public class delegates
{
public static T2DTriggerComponentOnEnterDelegate TheOption1
{
get { return _theOption1; }
}
public static void _theOption1(T2DSceneObject ourObject, T2DSceneObject theirObject)
{
//place your code here for the action you want to take place.
//play new music, turn day to night, etc...
}
}Thanks
About the author
Co-owner of Desktop Daydreams Studios. An Independent Game Studio and outsourcing service. www.desktopdaydreams.com
Torque 3D Owner Aaron Scovel
After reading comments #14 and #16, it appears your using the T2DTriggerComponent incorrectly.
Add the T2DTriggerComponent to a Blank Scene Object (this will be the trigger area). When the CollidesWith Object(the player) enters the trigger area, OnEnter is called, while the player is in the area OnStay is called, when the player exits the area OnLeave is called.
The Rainy Day tutorial has an example of the T2DTriggerComponent.