package com.ezardlabs.dethsquare;

/**
 * {@link Component} that contains the position of a {@link GameObject}
 */
public final class Transform extends Component {
	public Vector2 position = new Vector2();

	/**
	 * Move the {@link GameObject} that this {@link Transform} is attached to. If the {@link GameObject} has a {@link Collider} attached, then the physics
	 *
	 * @param x
	 * @param y
	 */
	public void translate(float x, float y) {
		if (gameObject.isStatic) throw new Error("Static objects cannot be moved");
		if (x == 0 && y == 0) return;
		if (gameObject.collider != null) {
			gameObject.collider.move(x, y);
		} else {
			position.x += x;
			position.y += y;
		}
	}
}

@@ -28,16 +28,45 @@
 quare;%0A%0A
+import java.util.ArrayList;%0A%0A
 /**%0A * %7B
@@ -229,16 +229,860 @@
 or2();%0A%0A
+%09private Transform parent;%0A%09private ArrayList%3CTransform%3E children = new ArrayList%3C%3E();%0A%0A%09Transform() %7B%0A%09%09position.setVector2ChangeListener((xDiff, yDiff) -%3E %7B%0A%09%09%09for (int i = 0; i %3C children.size(); i++) %7B%0A%09%09%09%09children.get(i).position.x += xDiff;%0A%09%09%09%09children.get(i).position.y += yDiff;%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%09public void setParent(Transform parent) %7B%0A%09%09setParent(parent, true);%0A%09%7D%0A%0A%09private void setParent(Transform parent, boolean addChild) %7B%0A%09%09this.parent = parent;%0A%09%09if (addChild) parent.addChild(this, false);%0A%09%7D%0A%0A%09public Transform getParent() %7B%0A%09%09return parent;%0A%09%7D%0A%0A%09public void addChild(Transform child) %7B%0A%09%09addChild(this, true);%0A%09%7D%0A%0A%09private void addChild(Transform child, boolean setParent) %7B%0A%09%09children.add(child);%0A%09%09if (setParent) child.setParent(this, false);%0A%09%7D%0A%0A%09public Transform getChild(int index) %7B%0A%09%09return children.get(index);%0A%09%7D%0A%0A
 %09/**%0A%09 *
@@ -1521,16 +1521,16 @@
 x += x;%0A
-
 %09%09%09posit
@@ -1545,13 +1545,99 @@
  y;%0A%09%09%7D%0A
+%09%09for (int i = 0; i %3C children.size(); i++) %7B%0A%09%09%09children.get(i).translate(x, y);%0A%09%09%7D%0A
 %09%7D%0A%7D%0A

Add first iteration of parent-child relationship between Transforms