Player Classes

The 3 classes that the player selects at the start

How it works:

I reconstructed FrmLevel to initially show a class selection menu with icons showing the classes and buttons that select which class you will be. Once the buttons are pressed the appropriate health and strength is altered for the player.

For the Tank:

    private void ClassTankButton_Click(object sender, EventArgs e)
    {
        player.MaxHealth = 50;
        player.Health = 50;
        player._strength = 1;
        this.Controls.Remove(ClassTankButton);
        this.Controls.Remove(ClassFighterButton);
        this.Controls.Remove(ClassAssassinButton);
        this.Controls.Remove(ClassMenuBackground);
        this.Controls.Remove(ChooseClassLabel);
        this.Controls.Remove(picPlayer);
        this.Controls.Remove(picAssassin);
        this.Controls.Remove(DisplayClassFighter);
        this.picPlayer = picTank;
    }
  • Set maxHealth and Health to 50

  • Set player's strength to 1

  • Remove the class menu

  • Assigns the player's icon to the tank icon

For the Fighter:

   private void ClassFighterButton_Click(object sender, EventArgs e)
   {
       player.MaxHealth = 20;
       player.Health = 20;
       player._strength = 2;
       this.Controls.Remove(ClassTankButton);
       this.Controls.Remove(ClassFighterButton);
       this.Controls.Remove(ClassAssassinButton);
       this.Controls.Remove(ClassMenuBackground);
       this.Controls.Remove(ChooseClassLabel);
       this.Controls.Remove(picTank);
       this.Controls.Remove(picAssassin);
       this.Controls.Remove(DisplayClassFighter);
   }
  • Set maxHealth and Health to 20

  • Set player's strength to 2

  • Remove the class menu

  • No need to assign the player's icon as it is set to fighter icon by default

For the Assassin:

    private void ClassAssassinButton_Click(object sender, EventArgs e)
    {
        player.MaxHealth = 15;
        player.Health = 15;
        player._strength = 3;
        this.Controls.Remove(ClassTankButton);
        this.Controls.Remove(ClassFighterButton);
        this.Controls.Remove(ClassAssassinButton);
        this.Controls.Remove(ClassMenuBackground);
        this.Controls.Remove(ChooseClassLabel);
        this.Controls.Remove(picPlayer);
        this.Controls.Remove(picTank);
        this.Controls.Remove(DisplayClassFighter);
        this.picPlayer = picAssassin;
    }
  • Set maxHealth and Health to 15

  • Set player's strength to 3

  • Remove the class menu

  • Assigns the player's icon to the assassin icon

Last updated