Text 101 : A Simple Adventure

Hey there. Here’s my take on the simple text adventure game.

v.02 http://www.sharemygame.com/share/2b11969c-031b-4a52-b969-68d0bf1682aa

V.01 http://www.sharemygame.com/share/1b5c75cd-92b6-4885-8aaf-6a397e8f0a53

1 Like


It seems some of the commands don’t work. When I died the “T” to try again didn’t do anything. Also, when I visited the town for the second time the News sign didn’t work.

Did you use some sort of random number generator for the encounters? I’d love to know how you did that? Also, is the damage and gold random or set for each type of enemy?

1 Like

Thanks for the feedback. I’ll see about fixing the bugs and putting up a better working version.

The random encounters feature is a bit of a mix. I actually built a second Enum variable to hold a bunch of different random encounters. Then when you enter the forest, one of those is picked randomly.

private void encounter()
    text.text = "At first, walking along under the trees is pleasant, but then" +
        "you hear rustling in the bushes nearby. Something's coming!\n\n" +
        "Press C to continue";

    if (Input.GetKeyDown(KeyCode.C))
        System.Random random = new System.Random();
        Array myList = Enum.GetValues(typeof(Encounters));
        myEncounter = (Encounters)myList.GetValue(random.Next(myList.Length));
        myState = States.randomEncounter;

The random encounter state checks the current encounter and uses it much in the same way as the main game state machine.

private void randomEncounter()
    if      (myEncounter == Encounters.goblin_one) { goblin_one(); }
    else if (myEncounter == Encounters.goblin_two) { goblin_two(); }
    else if (myEncounter == Encounters.rat_one)    { rat_one(); }
    else if (myEncounter == Encounters.rat_two)    { rat_two(); }
    else if (myEncounter == Encounters.thief_one)  { thief_one(); }
    else if (myEncounter == Encounters.thief_two)  { thief_two(); }

Then during the encounter I call a Victory function (if you chose to fight) which adjusts your health and gold by an amount set when calling the function, so if I wanted I could pass it a random range though for now each encounter has set numbers.

1 Like

Thanks! That is really interesting and cool.

1 Like

Updated version with fixed bugs is available.

1 Like

Great job!

I am working on a new one that includes the battle component you created, but in the meantime I finished my simple one. If you get a chance, let me know what you think.


1 Like

Privacy & Terms