public MainMenu() { this.player = Player.getPlayer(); newLabel("NameLabel", "Player Name:", playerLabelTop, labelsLeft, labelsWidth, this); newLabel("LevelLabel", "Level:", playerLabelTop + 25, labelsLeft, labelsWidth, this); newLabel("HpLabel", "HP:", playerLabelTop + 50, labelsLeft, labelsWidth, this); newLabel("LocationLabel", "Location:", playerLabelTop + 75, labelsLeft, labelsWidth, this); newLabel("ExpLabel", "EXP:", playerLabelTop + 100, labelsLeft, labelsWidth, this); newLabel("GoldLabel", "Gold:", playerLabelTop + 125, labelsLeft, labelsWidth, this); newLabel("playerNameLabel", player.name, playerLabelTop, playerLabelLeft, PlayersLabelWidth, this); newLabel("playerLevelLabel", player.level.ToString(), playerLabelTop + 25, playerLabelLeft, PlayersLabelWidth, this); newLabel("playerHpLabel", player.currentHp.ToString() + "/" + player.maxHp.ToString(), playerLabelTop + 50, playerLabelLeft, PlayersLabelWidth, this); newLabel("playerLocationLabel", player.currentLocation.name, playerLabelTop + 75, playerLabelLeft, PlayersLabelWidth + 40, this); newLabel("playerExpLabel", player.exp.ToString(), playerLabelTop + 100, playerLabelLeft, PlayersLabelWidth, this); newLabel("playerGoldLabel", player.gold.ToString(), playerLabelTop + 125, playerLabelLeft, PlayersLabelWidth, this); playerHpLabel = newLabel("playerHpLabel", player.currentHp.ToString() + "/" + player.maxHp.ToString(), playerLabelTop + 50, playerLabelLeft, PlayersLabelWidth, this); playerLocationLabel = newLabel("playerLocationLabel", player.currentLocation.name, playerLabelTop + 75, playerLabelLeft, PlayersLabelWidth + 40, this); changeLocationLabel(Player.getPlayer().currentLocation); playerInventoryList = new ListBox(); playerInventoryList.Top = 50; playerInventoryList.Left = 220; playerInventoryList.DataSource = Player.getPlayer().GetItemsName(); this.Controls.Add(playerInventoryList); InitializeComponent(); }
private void button4_Click(object sender, EventArgs e) { Player player = Player.getPlayer(); Cheese cheese = new Cheese(0); player.eat(cheese); updateHealth(); }