Explorar o código

Shortcut to remove all sprite children

deepnight %!s(int64=9) %!d(string=hai) anos
pai
achega
6cc432f16d
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      h2d/Sprite.hx

+ 5 - 0
h2d/Sprite.hx

@@ -272,6 +272,11 @@ class Sprite {
 		}
 	}
 
+	public function removeChildren() {
+		while( numChildren>0 )
+			removeChild( getChildAt(0) );
+	}
+
 	// shortcut for parent.removeChild
 	public inline function remove() {
 		if( this != null && parent != null ) parent.removeChild(this);