C
C#2w ago
DDmax500

✅ Trying and learning WFO

Been messing around with toolbox and thought about making a cookie clicker type of game. Its still in the very early stages as im experimenting. But I got stuck here after multiplier does not add up.
public partial class Form1: Form
{
private bool flag = false;
private int count = 0;
private int multiplier = 0;
public Form1()
{
InitializeComponent();
}

public void Form1_Load(object sender, EventArgs e)
{


}

public void button1_Click(object sender, EventArgs e)
{
if (flag == true)
{
count *= multiplier;
}
else
{
count++;
}
label2.Text = "Count: " + count.ToString();
label4.Text = "Multiplier: " + multiplier.ToString();

}

private void label2_Click(object sender, EventArgs e)
{

}

private async Task button1_Click_1(object sender, EventArgs e)
{
if (count >= 10)
{
multiplier++;
count = count - 10;
flag = true;
}
else
{
label3.Text = "Not enough";

}
}

private void label3_Click(object sender, EventArgs e)
{

}
}
}
public partial class Form1: Form
{
private bool flag = false;
private int count = 0;
private int multiplier = 0;
public Form1()
{
InitializeComponent();
}

public void Form1_Load(object sender, EventArgs e)
{


}

public void button1_Click(object sender, EventArgs e)
{
if (flag == true)
{
count *= multiplier;
}
else
{
count++;
}
label2.Text = "Count: " + count.ToString();
label4.Text = "Multiplier: " + multiplier.ToString();

}

private void label2_Click(object sender, EventArgs e)
{

}

private async Task button1_Click_1(object sender, EventArgs e)
{
if (count >= 10)
{
multiplier++;
count = count - 10;
flag = true;
}
else
{
label3.Text = "Not enough";

}
}

private void label3_Click(object sender, EventArgs e)
{

}
}
}
3 Replies
canton7
canton72w ago
It's kind of hard for us to figure out what this should be doing, particularly as your controls are called "button1" etc
Pobiega
Pobiega2w ago
The only place you increase the multiplier is in private async Task button1_Click_1(object sender, EventArgs e) which is randomly async Task, which isnt a valid event handler signature iirc there is also no awaits in it, meaning it deffo shouldn't be async Task
jcotton42
jcotton422w ago
@DDmax500 do yourself a favor, and give your forms and controls meaningful names.

Did you find this page helpful?