I'm having difficulties with coming up with a way to perform an action that I want done. I've tried several solutions, and I'm almost positive that I'm over looking something, or over thinking this. Hopefully someone can help me out.
I'm currently working on a piece of code that creates an array of 5 randomly selected digits. The main objective is to allow the player to figure out the pattern of numbers and their sequence through trial and error, however, if they don't perform the sequence in the correct order they must restart from the beginning, and do it within a set number of seconds. The problem I am having is making the player fall within those guidelines, currently it only works witht he below code
if(player[sequenceNumber]==pattern[sequenceNumber])
{
sequenceNumber++;
//play sound that alerts the player they've found the correct number.
}
The problem with this is that as soon as the if statement finishes there's no way to know if the player went directly to the next correct sequenced number, or if they chose an incorrect number before choosing the correct one, which if they did would have caused them to have to start over from the beginning according to the plan. If any more information is required I can try and provide it. Thanks in advance.
Pages 1