I've been working on the source code for an RPG game. This class I have here is the MainWorld class, a class designated to control movement in the game. So far, I've gone from about 70 to 13 compile errors. A few of them are syntax errors. The main ones are telling me that my type or namespace names are not found, even though I imported them into my code.
I'm also getting a message telling me I can't convert from int to string with my random functions. What's the fix for this?
I also have the full source code if you want to see the other classes.Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RpgTutorial { class MainWorld { List<Character> Monster; DataHandler data = new DataHandler(); Hero myhero; public void Mainworld(Hero hero, List<Character> monsters) { Console.Write(@" You are in a valley, not far from the town of Zalgalax. Where do you wish to travel? _____________________________ (NW) (N) (NE) (w) (E) (SW) (S) (SE) (Exit) _____________________________ "); Console.ReadLine(); choice = Console.ReadLine(); switch (answer) { case "NW": case "nw": case "Nw": Northwest northwest = new Northwest(myhero); case "N": case "n": North north = new North(myhero); case "NE": case "ne": case "Ne": Northeast northeast = new northeast(myhero); //NE class will be added later default: Console.WriteLine("I'm sorry, I didn't understand that."); return; } int battlechance; int setnumber; setnumber = 1; rand = new Random(); battlechance = Random.Next(1, 100); if (battlechance >= setnumber) { int randtwo; gibblychance = 10; string monsterchance; Console.WriteLine("Suddenly, a wild monster appears!"); monsterchance = randtwo.Next(1, 60); if (monsterchance = 1); { Monster.Add(new Zombie()); Monster.Add(new Zombie()); Monster.Add(new Zombie()); } if (monsterchance = 2); { Monster.Add(new Borg()); } if (monsterchance = 3); { Monster.Add(new Garryxx()); } if (monsterchance = 4); { Console.WriteLine("You've been attacked by a tribal raiding party!"); Monster.Add(new Barbarian()); Monster.Add(new Barbarian()); Monster.Add(new Mage()); } if (monsterchance = 5); { Monster.Add(new Slime()); } if (monsterchance = 6); { Console.WriteLine("A vicious warrior of Gorox appears, a Gorox Paladin!"); Monster.Add(new GoroxPaladin()); } Battle battle = new Battle(myhero, Monster); } } } }


Reply With Quote

Bookmarks