Okay...these are probably pretty basic, but it's been a rather annoying process.
I've tried Googling it to no avail. Basically, I've been learning C# (my first language) for about 4 days now and I feel that I've gained enough basic knowledge to begin work on my first application- a text-based RPG. However, I've run into a minor problem.
...
damage = rand.Next(4);
...
public static int totalDamage = damage - Player.Character.armor;
...
Character.health -= Monsters.totalDamage;
...
That's the code I'm basically having problems with. What happens is that sometimes, the monster deals damage below zero, which results in adding to the player's health pool. I tried changing the variable type to byte, but then I ran into ridiculously high numbers being generated. How can I make it so that the totalDamage variable can only equal a positive number?
The second question regards a random event. Basically, I'd like the character to randomly gain a sickness that reduces his stats. I was thinking of creating a timer and then using rand.Next()...ie:
public void Timer()
{
//code for timer
}
if (Timer >= rand.Next(100))
{
GiveAilment();
}
The problem with that is I don't know how to make that if statement run every, say, 5 minutes.
Thanks for any help!