Well, as pse-rpg is officially put off until the end of school, I figure I will use any and all free days I get to working on my new project of mine, the C# Adventure. It will be released in Chapters... each one with one town and one area, and will end with the Final Chapter


so far Chapter one is roughly.. err.. 2% done? I just started today really...

once I get all of the town of Chapter 1 done (named ChanTown) I shall release....

woo...
Out of curiosity, where did you get the nae "chantown" from o.o

That aside, what are you programming this with? C#, clearly, but are you using the console or XNA or some other method?
Actually, I was at first going to call it just "Town" but then I wanted it to be near the other source codes.... so I had to make it begin with C
ChanTown came to mind at first and I did not think of anything better

also, yes, it is C# and I am using the Console... (this is a txt based game I should mention)
Haha, that's better than I thought (4ChanTown). So you won't be doing anything like tilemaps, it will be a normal text based game like what Raylin submitted to the DCS topic? Sounds fun Smile If you need any help, highlight Merth (or the cool nickname []-tab)

Edit: Of course, you can highlight me, but Merth or Ben would know best.
Thanks for volunteering me Wink

This sounds like a cool project. I look forward to seeing progress.
heh, 4chantown chantown... only the latter because it begins with C...

and yes, I di plan it to be fun, two things...

1. There is a map, I plan to make each map 25 tiles, each area will have a boss a 5,5, but each step will make you fight a set enemy..

2. code will not be the best due to me being a bit of a n00b in C#, but I will try my best. this is mainly a learning experiance for me
*bump bump bump*


Code:
using System;
using System.Windows.Forms;

public class CTown {

   public int posu = 1;
   public int posl = 1;
   public bool action = false;

public CTown() {

Console.WriteLine("WELCOME TO CHANTOWN, the quiet place never to be attacked by monsters, just Anon");

}

public void ALchk() {   //performs a check of location and applies action.

if (posu == 0 || posl == 0) {

Console.WriteLine("Don't crash The Game, good job, now to restart");
Environment.Exit(0);

}


if (posu == 1 & posl == 1) {

Console.WriteLine("This is where you start");

   }                                                              // bloated code up ahead

if(posu == 1 & posl == 2) {
   string answer = "";
Console.WriteLine("Would you like to enter the E.V.I.L forest?");
   answer = Console.ReadLine();

if (answer2 == "yes") {
   Console.WriteLine("SUCKS, NO ENTERING FOR NAIO");
}

if (answer2 == "no"){
   Console.WriteLine("Ok, please move along then");   
   }

}

if(posu == 1 & posl == 3) {
   
   string answer = "";
   string answer2 = answer.ToUpper();
Console.WriteLine("Would you like to enter the E.V.I.L forest?");
   answer = Console.ReadLine();

if (answer2 == "yes") {
Console.WriteLine("SUCKS, NO ENTERING FOR NAIO");
}
if (answer2 == "no"){
Console.WriteLine("Ok, please move along then");   
   }
}

if(posu == 1 & posl == 4) {}

if(posu == 1 & posl == 5) {}

if(posu == 2 & posl == 1) {}

if(posu == 2 & posl == 2) {}

if(posu == 2 & posl == 3) {}

if(posu == 2 & posl == 4) {}

if(posu == 2 & posl == 5) {}

if(posu == 3 & posl == 1) {}

if(posu == 3 & posl == 2) {}

if(posu == 3 & posl == 3) {}

if(posu == 3 & posl == 4) {}

if(posu == 3 & posl == 5) {}

if(posu == 4 & posl == 1) {}

if(posu == 4 & posl == 2) {}

if(posu == 4 & posl == 3) {}

if(posu == 4 & posl == 4) {}

if(posu == 4 & posl == 5) {}

if(posu == 5 & posl == 5) {}

if(posu == 5 & posl == 5) {}

if(posu == 5 & posl == 5) {}

if(posu == 5 & posl == 5) {}

if(posu == 5 & posl == 5) {}

   }
}


I have too many if statements.... help?

Code:
switch (posu * 5 + posl) {
   case 1:
      blah;
      break;
   case 2:
      blah;
      break;
   case 3:
      blah;
      break;
   ...
}

Use posu*5+posl to map to a single value, and switch on that to handle all the cases. If there're two things that do the same thing you can do:

Code:
case 4:
case 5:
      blah;
      break;
ah, ok, I see then. Thanks Merth and weregoose. I see how this works, I do think I will make some adjustments so that it fits my needs, I shall post more when I get some time to code later on...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement