Ok, I have understand the methodes, learn how to write them but when I come to the part where I have to use the I get all confused. Here are methodes for text
game that I created. I need to use them, but i have problem. I dont know I to put them to interact between each other. It is easy with "Switch" or "if" statment where you easyle guide user, but I just dont how to do it with methodes. I think I didnt explain my problem well, sorry for english
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static string ChoiceA()
{
string Attack;
Console.WriteLine("Enter 'Attack' to attack with your Hero");
Attack = Console.ReadLine();
Console.WriteLine();
return Attack;
}
static string ChoiceD()
{
string Defend;
Console.WriteLine("Enter 'Defend' to defend your self from monster");
Defend = Console.ReadLine();
Console.WriteLine();
return Defend;
}
static int HeroBettle(int monsterHitpoints, int heroBattleDemage)
{
monsterHitpoints = 25;
Random rand;
rand = new Random();
heroBattleDemage = rand.Next(4, 8);
monsterHitpoints = monsterHitpoints - heroBattleDemage;
Console.WriteLine("Your Hero attacks with {0} demage", heroBattleDemage);
Console.WriteLine("");
Console.WriteLine("The monster has {0} hp", monsterHitpoints);
return monsterHitpoints;
}
static int HeroDefends(int HeroHitPoints, int MonsterDefendedBettleDemage)
{
HeroHitPoints = 30;
Random rand;
rand = new Random();
MonsterDefendedBettleDemage = rand.Next(2, 5);
HeroHitPoints = HeroHitPoints - MonsterDefendedBettleDemage;
Console.WriteLine(@"The monster attacks with {0} demage and the hero defends him self, receiving minimal
demage", MonsterDefendedBettleDemage);
Console.WriteLine("The Hero has {0} hp", HeroHitPoints);
return HeroHitPoints;
}
static int MonsterBettle(int heroHitPoints, int monsterBettleDemage)
{
heroHitPoints = 25;
Random rand;
rand = new Random ();
monsterBettleDemage = rand.Next(5, 10);
heroHitPoints = heroHitPoints - monsterBettleDemage;
Console.WriteLine("The monster attacks with {0} demage", monsterBettleDemage);
Console.WriteLine("");
Console.WriteLine("The hero has {0} hp", heroHitPoints);
return heroHitPoints ;
}
static void Main(string[] args)
{
}
}
}
I easyly done it with digitron because that is a bit easy, but this one is hard (for me )--
thanks