TX/T2DSceneObject
From TDN
|
[edit] Introduction
[edit] LinkPointsLink point component for scene object, or null if it doesn't have one. Note: link point component is not cached on object, so this property causes a component lookup. T2DLinkPointComponent linkPoint = SceneObject.LinkPoints; More information on T2DLinkPointComponent [edit] SizeSyntax public virtual Vector2 Size { get; set; }The Size method allows you to resize the object including any CollisionPolygon and image attached to the object ((T2DSceneObject)Owner).Size = ((T2DSceneObject)Owner).Size / 2; This example only half's the X value of the object ((T2DSceneObject)Owner).Size = new Vector2(((T2DSceneObject)Owner).Size.X / 2, ((T2DSceneObject)Owner).Size.Y); [edit] VisibilityLevelSyntax public float VisibilityLevel { get; set; }Sets alpha blend value to control the degree of visibility. If Visible property is false then object is not visible no matter what this value is. It takes values from 0 (invisible) to 1 (solid).
<SimpleMaterial name="GGLogoMaterial" type="GarageGames.Torque.Materials.SimpleMaterial">
<TextureFilename>data/images/GGLogo.png</TextureFilename>
<IsTranslucent>true</IsTranslucent>
<IsColorBlended>true</IsColorBlended>
</SimpleMaterial>
In game code T2DAnimatedSprite sceneObject = SceneObject as T2DAnimatedSprite; SimpleMaterial _renderMaterial = sceneObject.AnimationData.Material as SimpleMaterial; _renderMaterial.IsColorBlended = true; _renderMaterial.IsTranslucent = true; And then you just need to change the visibility level: SceneObject.VisibilityLevel = 0.5f; Note: If you are using the material as a particle, it seems to allow the visibility level to work without changing material properties. (It must change it when the game is running) [edit] VisibleSyntax public bool Visible { get; set; }True if visible. Collisions are also disabled if not visible.
private T2DCollisionImage _collisionImage;
protected override bool _OnRegister(TorqueObject owner)
{
ReadOnlyArray<T2DCollisionImage> images = myOwner.Collision.Images;
Assert.Fatal(images.Count > 0, "There are no T2DCollisionImages installed on this object");
_collisionImage = images[0];
}
protected void RemoveImage()
{
((T2DSceneObject)Owner).Collision.RemoveImage(_collisionImage);
}
|




