how to check if something already happened?


i need make text adventure school. have if statements take player other "location"(just text). problem can't seem figure out how make player can go place once. 

just how it's coded now,

if player types this, type out this

else if player types this, type out this

etc.

well it's school assignment part of learning process explore possibilities.

just giving solution kind of blow point.

but...

you could make each place person goes location object along lines of:

public class location() {   public bool visited;   public string outputstring;    public void dosomethingatlocation()   {    }  }

you want how give default value when instantiating object visited false initially.

then when go somewhere can test visited if , based on that, set when have "been" there.

maybe have public method outputs location's text , sets visited.

you new bunch of locations , put them in list of 2 dimensional array.

with 2d array calculate when go north such , such means go to... in array.

.

hope helps , still leaves things learn.




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'