- Home /
Opinion on this level upgrading system?
Uhh there's not much details to it, I made this level upgrading system, and I was just wondering what the community thinks of it!
Btw this was made in visual studio with forms. Just because it was easier, and I rly just wanted to create a level upgrading system.
And just so it's clear. That double "experience", would be the necessary experience to upgrade to the next level.
public partial class Form1 : Form
{
// todas as variáveis / All variables
int level = 0;
double health = 100, baseHealth = 100;
double damage = 30, baseDamage = 30;
double experience = 1000, baseExperience = 1000;
double healthGap = 10;
double damageGap = 5;
double experienceGap = 50;
double exponentialHealthGrowth = 1.5;
double exponentialDamageGrowth = 1;
double exponentialExperienceGrowth = 1;
/// NAO INTERESSA AQUI
public Form1()
{
InitializeComponent();
levelLbl.Text = "Level: " + level.ToString();
}
/// NAO INTERESSA AQUI // This was a btn that ups one level
private void up1Btn_Click(object sender, EventArgs e)
{
level++;
updateLevel();
}
/// NAO INTERESSA AQUI // This was a btn that downs one level
private void less1Btn_Click(object sender, EventArgs e)
{
level--;
updateLevel();
}
/// NAO INTERESSA AQUI // This was a btn that sets a level. Used a textbox for this one
private void setLvlBtn_Click(object sender, EventArgs e)
{
level = Convert.ToInt32(setLevelTxt.Text);
updateLevel();
}
/// <summary>
/// IMPORTANTE HERE
/// </summary>
void updateLevel()
{
// Velocidade em que os stats do player evoluiem / Velocity in which player stats evolve
exponentialHealthGrowth = 1.1;
exponentialDamageGrowth = 1.07;
exponentialExperienceGrowth = 1.05;
// aumenta todos os valores da gap entre os níveis / calculates the new gap diference between the levels
expectedLbl.Text = "Expected: " + (healthGap = baseHealth + Math.Round(Math.Pow(exponentialHealthGrowth, level - 1))) + " / " + Math.Round((experienceGap = baseExperience + Math.Pow(exponentialExperienceGrowth, level - 1))) + " / " + Math.Round((damageGap = baseDamage + Math.Pow(exponentialDamageGrowth, level - 1)));
levelLbl.Text = "Level: " + level.ToString();
// reseta todos os atributos / resets all stats to level 1
health = 100;
damage = 30;
experience = 100;
// Vai adicionando os atributos novamente para ter uma evolução mais fácil e controlável, ou seja passa por cada nível / Adds all levels one by one, since im using this "gap system"
for(int i = 0; i < level; i++)
{
healthLbl.Text = "Health: " + Math.Round((health += healthGap));
experienceLbl.Text = "Experience: " + Math.Round((experience += experienceGap));
damageLbl.Text = "Damage: " + Math.Round((damage += damageGap));
}
}
}
Results:
Level 10 - health: 1120 | experience: 10116 | damage: 348
Level 20 - health: 2200 | experience: 20151 | damage: 702
Level 30 - health: 3580 | experience: 30223 | damage: 1143
Level 40 - health: 5740 | experience: 40368 | damage: 1790
Level 50 - health: 10450 | experience: 50648 | damage: 2906
Level 60 - health: 22720 | experience: 61167 | damage: 5079
Level 70 - health: 57360 | experience: 72128 | damage: 9587
Level 80 - health: 157060 | experience: 83876 | damage: 19195
Level 90 - health: 443800 | experience: 97020 | damage: 39832
Level 100 - health: 1262900 | experience: 112624 | damage: 84125
Your answer
Follow this Question
Related Questions
Leveling up in RPG 1 Answer
Where do I put PlayerPrefs.SetInt? 1 Answer
frustrating building problem 0 Answers