I finished my own Text Adventure and want to add a little extra-feature. My goal is to show on the top left hand corner of the screen in which “Location” the player finds himself in (e.g. see picture).
I would like Textbox 2 to change whenever the player goes to the next state (e.g. House or Plane).
What I already tried was to create a second textbox and a second script that extends the script for the first textbox, so that I can say: if the player is in state “x” the textbox 2 should print “x” location’s name. Unfortunetaly, I could not figure out how to do so.
Is there any way to do so?
I tried to do the same but it’s not working, when I put the location.text = "room"; my game does’t work
void state_room(){
location.text = "Room";
text.text = "You are in your room, and you want to escape. There are " +
"some dirty sheets on the bed, a window and two doors. " +
"One is locked from outside and another is the bathroom.\n\n" +
"Press S to view Sheets, W to view the Window, L to view the Lock and B to view the Bathroom";
if (Input.GetKeyDown (KeyCode.S)) {myState = States.sheets_0;}
else if (Input.GetKeyDown (KeyCode.L)) {myState = States.lock_0;}
else if (Input.GetKeyDown (KeyCode.W)) {myState = States.window_0;}
else if (Input.GetKeyDown (KeyCode.B)) {myState = States.bathroom_0;}
}
I’m pretty sure @Bryan_FP has given you the answer in his post, but thought I would share this User Guide with you for the future, as it will help make your posted code a lot easier to read.
It worked,
I did what you said, first I was trying dragging only the one text to location and the other one to text, now I did the way u did on the pic and worked.