standard draw is key pressed skips stages
<p>In standard draw there is a <code>isKeyPressed()</code> function. The function returns a <code>boolean</code> indicating if the parameter was pressed.</p>

<p>In a text based game I am making, the user will press <code>y</code> or <code>n</code>to determine an outcome. Sometimes, but not always, the following story text is skipped. here is my code. I am running this in eclipse. This is not all of my code, but where I believe the problem is.</p>

<pre><code>while(true){

else if(stage == 6){

StdDraw.textLeft(0, 700,"'so, ya name's "+ name + ", huh?'");

StdDraw.textLeft(0, 680,"'What an odd name if i do say so.'");

StdDraw.textLeft(0, 660,"'you're lucky i found you when i did, the dark forest is dangerous!'");

StdDraw.textLeft(0, 620,"'So, you heading to Ivangard, right?'(y/n)");
            counter = 1;

if(StdDraw.isKeyPressed('Y')&amp;&amp;frame%8==0){

stage = 7;

            }
else if (StdDraw.isKeyPressed('N')&amp;&amp;frame%8==0){
                    stage = 9;
            }
        }
else if(stage == 7){

StdDraw.textLeft(0, 700,"'well lucky you! i'm going in the same direction!'");

    StdDraw.textLeft(0, 680,"'Well i'm Program "+ random +", nice to meet you.'");

    StdDraw.textLeft(0, 660,"'take this rusty dagger. may be of use!'");

    StdDraw.textLeft(0, 640,"'ill see you in Ivangaurd!'");

                    StdDraw.textLeft(0, 500,"continue?(O)");

                    if(StdDraw.isKeyPressed('O')&amp;&amp;frame%12==0){

                        stage = 11;

                        programn = random;

                        fist = 0;

                        rustyd = 1;

                }

                }



            else if(stage == 9){

        StdDraw.textLeft(0, 700,"'Well, if you need me, ill be in Ivangaurd'");

        StdDraw.textLeft(0, 680,"'I'm Program #"+ random +", nice to meet you.'");

        StdDraw.textLeft(0, 660,"'take this rusty dagger. may be of use!'");

                StdDraw.textLeft(0, 620,"continue?(O)");

                counter = 1;

                programn = random;

                fist = 0;

                rustyd = 1;



                if(StdDraw.isKeyPressed('O')&amp;&amp;frame%12==0){

                    stage = 11;

            }

            }

else if(stage == 11){

        StdDraw.textLeft(0, 700,"Part 2: The virus");

    StdDraw.textLeft(0, 660,"as you leave the dark forest, The voice comes back");

    StdDraw.textLeft(0, 640,"A great evil is coming to this land.");

        StdDraw.textLeft(0, 620,"a virus, a plague the program...");

        StdDraw.textLeft(0, 600,"unlike the program, all the virus does is eat.");

                StdDraw.textLeft(0, 580,"That is why we need you.");

StdDraw.textLeft(0, 560,"you are human, uneatable to the virus. All other warriors would fall were you stand.");

                StdDraw.textLeft(0, 540,"continue?(0)");

                if(StdDraw.isKeyPressed('O')&amp;&amp;frame%12==0){

                    stage = 10;

                }

            }

}
</code></pre>

<p>The problem is after the y/n option, it skips the following text.</p>

<p>the new text is here. I am novice coder, so i may not have understood what you told me to do.</p>

<pre><code>else if(stage == 6){
            StdDraw.textLeft(0, 700,"'so, ya name's "+ name + ", huh?'");
            StdDraw.textLeft(0, 680,"'What an odd name if i do say so.'");
            StdDraw.textLeft(0, 660,"'you're lucky i found you when i did, the dark forest is dangerous!'");
            StdDraw.textLeft(0, 620,"'So, you heading to Ivangard, right?'(y/n)");
            counter = 1;
            if(StdDraw.isKeyPressed('Y')&amp;&amp;frame%8==0){
                stage = 7;

            }
            if(StdDraw.isKeyPressed('N')&amp;&amp;frame%8==0){
                stage = 9;
            }
        }
</code></pre>
