We need to show the player the word that they need to find from that grid of words that we have that
are all scrambled up.
So we need a way to display that word to the player.
So select this word.
But we actually also should do select this word.
And so the word that we're want to select.
So adding that in and the word player is going to be looking for is going to be the first word in the
array.
And we also need a way to kind of move through all of the words from the array so we can start out with
value of current and set that to zero.
And when we start the game, then we can make sure that current is set at zero and we're going to update
and output that value of the word.
So moving along and as we select the right word, we're going to increase the value of current and then
show the next word in the order.
So instead of having it happen here, we need to just send over a function in order to accommodate that.
So taking that value of function and we just call it next word.
So it's going to simply output whatever the next word is in order and it's going to take the value of
current and output that value.
So it's going to be a global variable so we can always access it.
So what's going to happen here is that we're going to output the value of next word.
And the way that that works is we're going to take that message and output it here.
And right now it's going to take the my words array and simply update and output the word that we're
on currently.
And you can see that when I take next word, that I can output that message to the player and then also
I can output that message to the player here as well, although here we're going to increment the next
word by one.
So let's try that out and going in, press the button.
So select the word LOWRANCE So we need to make sure that the player can click the words next.
They're going to be selecting brackets.
So this one is brackets and we need to check to make sure that it is correct before we move them along.
We've got next word undefined because we ran through the array and this is the point where the game
concludes.
So next up, we need to make sure that we're checking to see if the player is actually selecting the
right word before we move on to the next word.
And if they're not, then we're just going to say wrong and let them move on to the next word.
And we're going to add that into in the next lesson.
So for now, go ahead and create a function that's going to move us along to the next word.