Game Development Community

How to create a container which size is "300 200" and add 2 or more sprite inside .

by laukwongming · in Torque 2D Beginner · 05/26/2014 (3:44 am) · 7 replies

How to create a container which size is "300 200", and create two or more sprite inside.
if sprite position is off screen, the container will auto clipping.

About the author

Recent Threads


#1
05/26/2014 (4:41 am)
You need to use a CompositeSprite object. It does exactly what you describe.
#2
05/26/2014 (7:32 am)
how to do that ?
i use it to create 2 or more sprites , but how to clipping out of bounds image ?

just like ios uiview 's clipsToBounds
#3
05/26/2014 (1:44 pm)
CompositeSprite automatically clips its children when they are not in camera view. Open the CompositeSpriteToy, then turn on the metrics to see draw calls and poly count. You can zoom in with the mouse wheel and see the numbers drop as less sprites are in view. The toy also has example code on the various ways to populate a CompositeSprite via layouts, sizing, and movement. For more information, the GitHub wiki pages for T2D has more technical information.
#4
05/26/2014 (9:56 pm)
if children inside camera view ? how to automatically clips its?
#5
05/27/2014 (5:42 am)
I thought you asked if the children were outside of the camera view. Nothing inside of the camera view is clipped.
#6
05/27/2014 (6:49 am)
I think he's wanting something like a "sub-window" - so perhaps a second scene sized and placed correctly?
#7
05/27/2014 (8:30 am)
ya, like a sub window,
i need to create 9 sub window inside a main window.
but when i resize window, 9 sub window will not resize automatically

such as cocos-x2d sublayer function .