public void drawBox(SpriteBatch sb) { sb.Draw(getGraphic(), new Vector2(this.x, this.y), Color.White); if (storedItem != null) { if (!selected) { storedItem.setX(this.x + 34); storedItem.setY(this.y + 34); } sb.Draw(storedItem.getGraphic(), new Vector2(storedItem.getX(), storedItem.getY()), Color.White); storedItem.setHitBox(new Rectangle(this.x + 34, this.y + 34, 32, 32)); } }
public void drawInventory(SpriteBatch sb) { float alpha = 1.0f; if (transparent) { alpha = 0.5f; } sb.Draw(inventoryGraphic, new Vector2(this.x, this.y), new Color(Color.White, alpha)); for (int x = 0; x < items.GetLength(0); x++) { for (int y = 0; y < items.GetLength(1); y++) { if (items[x, y] != null) { sb.Draw(items[x, y].getGraphic(), new Vector2(items[x, y].getX() + this.x, items[x, y].getY() + this.y), new Rectangle(0, 0, 32, 32), new Color(Color.White, alpha)); items[x, y].setHitBox(new Rectangle(items[x, y].getX() + this.x, items[x, y].getY() + this.y, 32, 32)); } } } //Draw the selected item last so it is on bottom. if (selectedItem != null) { sb.Draw(selectedItem.getGraphic(), new Vector2(selectedItem.getX() + this.x, selectedItem.getY() + this.y), new Rectangle(0, 0, 32, 32), new Color(Color.White, alpha)); } }