Clipping a sprite
by John Pritchett · in Torque Game Builder · 07/27/2005 (9:15 am) · 0 replies
I posted a question for how to clip a sprite and I didn't get any response. So I'll assume that there isn't a feature currently in the engine that allows this.
What I'd like to be able to do is specify a clipping rectangle on a sprite object. This is useful for various effects, and placing a background-colored sprite over the top is only a limited solution. One very simple example of how this might be used is a gauge bar. As the value it tracks shrinks, the bar gets shorter, and as it grows, it gets longer. When the bar is uniform, you can just change the width to make it grow or shrink (though this places certain restrictions on the placement of the bar within the sprite body). But when the bar is non-uniform, it would be better to see it truncated than squished as it shrinks.
What I'd like to be able to do is specify a clipping rectangle on a sprite object. This is useful for various effects, and placing a background-colored sprite over the top is only a limited solution. One very simple example of how this might be used is a gauge bar. As the value it tracks shrinks, the bar gets shorter, and as it grows, it gets longer. When the bar is uniform, you can just change the width to make it grow or shrink (though this places certain restrictions on the placement of the bar within the sprite body). But when the bar is non-uniform, it would be better to see it truncated than squished as it shrinks.
About the author
Indie developer since 1994, games include TradeWars 2002 (named 10th best PC game of all time by PCWorld magazine), TW: Dark Millennium/Exarch/Dungeon Runners, and Rocketbowl 360. Have worked for Martech Software, 21-6, EIS and Black Squirrel Studios.