public void updateCreateCharacterButton() { if (Gdx.input.justTouched()) { Rectangle mousePos = Utils.getMenuMousePos(); Ent btnAdd = this.getEntByName("btnAddCharacter"); if (mousePos.overlaps(btnAdd.getPosBox())) { this.setCurrentSubMenu(this.getSubMenuByName("createcharacter")); Ent btnSelect = this.getEntByName("btnSelect"); for (Ent btn : this.getEnts()) { if (btn.getName().contains("Tile") && btn.getName().contains("btn")) { if (btn.getName().equals("btnDeleteTile")) { btnSelect.setPosBox(new Rectangle(btn.getPosBox())); } btn.setState(State.NORMAL); } } } } }
public void selectTile() { if (Gdx.input.justTouched()) { Rectangle mousePos = Utils.getMenuMousePos(); Ent btnSelect = this.getEntByName("btnSelect"); Ent selectedTile = null; for (Ent e : this.getEnts()) { if (e.getName().contains("btn") && e.getName().contains("Tile")) { if (mousePos.overlaps(e.getPosBox())) { e.setState(State.SELECTED); btnSelect.setPosBox(new Rectangle(e.getPosBox())); selectedTile = e; } } } if (selectedTile != null) { for (Ent e : this.getEnts()) { if (e.getName() != selectedTile.getName()) { e.setState(State.NORMAL); } } } } }