Clipping a sprite
by John Pritchett · in Torque Game Builder · 07/20/2005 (11:59 am) · 3 replies
Is there a simple method to clip a sprite? For example, suppose I have a sprite that's 100 pixels long, with a bar that's centered and 80 pixels long. Now suppose I want to truncate that bar so that only the left half is visible. This seems like a simple task for a clipping rectangle on the sprite, but I don't see anything like this in the docs. Can anyone point me in the right direction?
Thanks!
Thanks!
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.
#2
07/30/2005 (9:26 pm)
www.garagegames.com/mg/forums/result.thread.php?qt=28481 should get you on your way.
#3
07/31/2005 (8:14 am)
That'll work. Thanks!
Torque Owner Neo Binedell
Obviously thats if you are doing stuff in C++.
If so then you could just use UV range of u=0.5, v=1.0 instead of u=1.0,v=1.0?
Hmm... that could actually be integrated nicely into the T2D code by
having say a clip rect that affected the underlying U,V coords.
Which would allow e.g having a progress bar, etc by just adjusting the cliprect
in X as well as a ton of other ideas.
Basically like masks in Macromedia Flash.
Melv?
~neo