Game Constructor (TextBox) | ![]() |
[This is preliminary documentation and is subject to change.]
Namespace: EJW.TextBasedAdventure
public partial class MainForm : Form { public Game g; public MainForm() { InitializeComponent(); g = new Game(textBoxInput,textBoxOutput); g.Rooms.Add( "HallWay","You're standing in the hallway of an old house. There is a rug on the floor and pictures on the walls." ); g.Rooms.Add( "Kitchen","You're standing in a kitchen. There is a trapdoor in the floor." ); g.Rooms.Add( "Cellar","A dank smelly cellar." ); //Simple navigation between the rooms: g.Rooms["Hallway"].AddNav( Direction.North, g.Rooms["kitchen"] ); g.Rooms["Kitchen"].AddNav( Direction.South, g.Rooms["hallway"] ); g.Rooms["Cellar"].AddNav( Direction.Up, g.Rooms["kitchen"] ); //Some Things: g.Things.Add( "torch","It's old - but it looks like it works...",g.Rooms["kitchen"] ) ; g.Things.Add( "key","An old rusty key." ); //The key will be hidden at first: and will only appear when the rug is inspected g.Things.Add( "biscuit","Chocolate chip. Probably safe to eat!",g.Rooms["kitchen"] ); g.Things.Add( "box", "a pretty box", g.Rooms["hallway"]).Container = true; } void MainFormShown(object sender, EventArgs e) { g.Start(); } }