using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Battle_Simulator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Random attackChance = new Random();
int health = 1000;
int critStrike = 200;
int strike = 100;
int hit = attackChance.Next(1, 100);
//hit can either be 1 to 100.
if(hit >= 60)
{
MessageBox.Show("You Hit the Monster for: 100");
label6.Text = (health - strike).ToString();
}
else if((hit > 40) && (hit < 60))
{
MessageBox.Show("You Critically Hit the Monster for: 200 Damage!" );
label6.Text = (health - critStrike).ToString();
}
else{
MessageBox.Show("Your Attack Missed");
}
if(health <50)
{
MessageBox.Show(" YOU HAVE SLAIN THE MONSTER!");
}
}
}
}
I hope you can help.

New Topic/Question
Reply




MultiQuote




|