Thank you for your response, I’ve just tried but no success
Try using Input.GetKeyDown(KeyCode.Z)
instead of Input.GetKey(KeyCode.Z)
are you sure? this code below should fix it
void Update ()
{
print (myState);
if (myState == States.cell) {cell();}
else if (myState == States.table_0) {table_0();}
else if (myState == States.table_1) {table_1();}
else if (myState == States.lock_0) {lock_0();}
else if (myState == States.lock_1) {lock_1();}
else if (myState == States.corpse) {corpse();}
else if (myState == States.cell_key) {cell_key();}
else if (myState == States.corridor_0) {corridor_0();}
else if (myState == States.corridor_1) {corridor_1();}
}
…and I concur with @Rivaldragon too, your button press wont be being recognised… two issues - well spotted guys
Updated my code with your suggestions, and it still won’t progress further than "Amber Light engulfs you,
I really hope we can spot the issue!
Can you check the link? I’m not being able to access it
That should work now
it is missing an opening parenthesis here:
void corridor_0() {
text.text = "You're in the corridor!\n" +
"Amber light engulfs you.\n\n" +
"Press Z to continue";
if **>> <<**Input.GetKeyDown(KeyCode.Z)) {myState = States.corridor_1;}
Oh my, it’s still not working. I’m not sure how I’ve messed this up so much.
Hey, no problem this happens all the time to most of us
So, the compiler is returning any kind of error? Or it just don’t change the state after corridor_0?
If it is returning an error, would you mind pasting it?
Otherwise, we can debug and look for it adding a print to the if statement under corridor_0 like this:
Wow this community is so nice!
@Joao_Dalvi It’s not returning an error, it’s just not proceeding passed the corridor_0 statement!
Pasted that line of code, still doesn’t run =[
The line inside the print appears in the console when you press Z while under the corridor_0 state?
Doesn’t seem too
well, if nothing is appearing within the console when you press Z and if the text under corridor_0 is appearing, seems that the error is within the if itself:
would you mind trying different keycodes and see if it run? something like:
If this don’t work, try taking out the if statement and just put straight and see how it behaves:
let’s try to find where is the problem
Ok, so I’ve done this, and the issue remains the same!
The console is showing corridor_1 playing in game, climbing to over 80000 in console
The corridor_1 text don’t appear in the game window?
No, only in console
What is displayed in the game window? Can you pop a screenshot up perhaps.