src/gameplayer/view/LevelModel.java
private Pane createIndividualEntityGroup(Map<Integer, Map<String, Component>> entityMap) {
		Pane entityRoot = new Pane();
		entityMap.forEach((key, value) -> {
			if(value.containsKey(Sprite.KEY)) {
				Sprite spriteComponent = (Sprite) value.get(Sprite.KEY);
				ImageView image = spriteComponent.getImage();

				if (value.containsKey(XPosition.KEY) && value.containsKey(YPosition.KEY)) {
					setSpritePosition((XPosition) value.get(XPosition.KEY), (YPosition) value.get(YPosition.KEY), image);
				}

				if(value.containsKey(Width.KEY) && value.containsKey(Height.KEY)) {
					setSpriteSize((Width) value.get(Width.KEY), (Height) value.get(Height.KEY), image);
				}

				if (value.containsKey(Type.KEY)) {
					SingleStringComponent entityTypeComponent = (SingleStringComponent) value.get(Type.KEY);
					if (entityTypeComponent.getData().equals("Background")) {
						entityRoot.getChildren().add(0, image);
					}
					else {
						entityRoot.getChildren().add(image);
						spriteComponent.setOnImageRemoved((e) -> entityRoot.getChildren().remove(image));
					}
				}
			}
		});
		return entityRoot;
	}
/**
	 * Method that creates all the groups for each level in a levelMap.
	 * @param entityMap
	 * @return
	 */
Method that creates all the groups for each level in a levelMap.
@param entityMap
@return
Method that creates all the groups for each level in a levelMap . @param entityMap @return
private Pane createIndividualEntityGroup(Map<Integer, Map<String, Component>> entityMap) {
		Pane entityRoot = new Pane();
		entityMap.forEach((key, value) -> {
			if(value.containsKey(Sprite.KEY)) {
				Sprite spriteComponent = (Sprite) value.get(Sprite.KEY);
				ImageView image = spriteComponent.getImage();
				if (value.containsKey(XPosition.KEY) && value.containsKey(YPosition.KEY)) {
					setSpritePosition((XPosition) value.get(XPosition.KEY), (YPosition) value.get(YPosition.KEY), image);
				}
				if(value.containsKey(Width.KEY) && value.containsKey(Height.KEY)) {
					setSpriteSize((Width) value.get(Width.KEY), (Height) value.get(Height.KEY), image);
				}
				if (value.containsKey(Type.KEY)) {
					SingleStringComponent entityTypeComponent = (SingleStringComponent) value.get(Type.KEY);
					if (entityTypeComponent.getData().equals("Background")) {
						entityRoot.getChildren().add(0, image);
					}
					else {
						entityRoot.getChildren().add(image);
						spriteComponent.setOnImageRemoved((e) -> entityRoot.getChildren().remove(image));
					}
				}
			}
		});
		return entityRoot;
	}
private Pane createIndividualEntityGroup ( Map < Integer , Map < String , Component > > entityMap ) { Pane entityRoot = new Pane ( ) ; entityMap . forEach ( ( key , value ) -> { if ( value . containsKey ( Sprite . KEY ) ) { Sprite spriteComponent = ( Sprite ) value . get ( Sprite . KEY ) ; ImageView image = spriteComponent . getImage ( ) ; if ( value . containsKey ( XPosition . KEY ) && value . containsKey ( YPosition . KEY ) ) { setSpritePosition ( ( XPosition ) value . get ( XPosition . KEY ) , ( YPosition ) value . get ( YPosition . KEY ) , image ) ; } if ( value . containsKey ( Width . KEY ) && value . containsKey ( Height . KEY ) ) { setSpriteSize ( ( Width ) value . get ( Width . KEY ) , ( Height ) value . get ( Height . KEY ) , image ) ; } if ( value . containsKey ( Type . KEY ) ) { SingleStringComponent entityTypeComponent = ( SingleStringComponent ) value . get ( Type . KEY ) ; if ( entityTypeComponent . getData ( ) . equals ( "Background" ) ) { entityRoot . getChildren ( ) . add ( 0 , image ) ; } else { entityRoot . getChildren ( ) . add ( image ) ; spriteComponent . setOnImageRemoved ( ( e ) -> entityRoot . getChildren ( ) . remove ( image ) ) ; } } } } ) ; return entityRoot ; }
Method that creates all the groups for each level in a levelMap.
Method that creates all the groups for each level in a levelMap .