package gameEngine.entites; import gameEngine.entites.gameComponents.GameComponent; import java.util.ArrayList; import java.util.List; public class GameObject extends Entity { private final List<GameComponent> gameComponents = new ArrayList<>(); public GameObject(int id) { super(id); } public void addComponent(GameComponent component) { this.gameComponents.add(component); } public void initComponents() { for (GameComponent component : gameComponents) { component.init(); } } public void updateComponents() { for (GameComponent component : gameComponents) { component.update(); } } }