Sign in to follow this  
Ostridge

C# text game help

Recommended Posts

hi everyone, im making a rather simple text based game using c# and visual c# 2008. I have a battle system and an item system(can use potions and equipt weapons etc) but I have a problem though. The game displays text in a richtext box and the user is supposed to type his response and then the game goes from there. The problem is am i supposed to have tons and tons of if statements to determine what the user is doing? Lets say at one point the user can either go left or right, do i have to have an if statement for that and then if statements inside of that determining what the user is doing later on? Is there a simpler way to achieve the same thing or am i going to have to create lots of if statements. any help would be appreciated! :)

Share this post


Link to post
Share on other sites
The logic has to exist somewhere. Some things might ease the burden or generalize things better, but that'd depend a bit on some more of the specifics of your game.

Share this post


Link to post
Share on other sites
Yes dude, i tried the same thing you are doing, it is only natural that some at some point there will be alot of conditional statements somewhere. I kept there numbers down by specially designing objects that i linked together(kinda of like linked lists only not quite the same) and used them to keep track of the game objects that needed to be functions that needed to be ran. when it was time to redraw the screen i woulud terminate the list of objects. then once again every individual game element will slowly build a new one, each adding to the list and then i would sort through it, have the program execute each function(i used alot of function pointers for this one, also i wrote this in c++ so i'am not quite sure c# even supports function pointers) on the list then finally once the ending one was reached i would have the list destroyed and it wud repeat... gosh it was horriblely hard lol gl.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this