Re: Simon -
12-08-2011, 06:23 AM
Hey Blunted_what:
This is what I did to compare the lists, though I don't know if it's the best way. I'm a beginner muddling my way through.
Create a global function that contains 2 empty lists as the parameters. Create an if-else statement comparing the size of the 2 parameter lists, and have it return 1 if they are not equal. Then add a loop to the function containing another if-else statement comparing the list parameters for inequality, looping the size of one of the lists and using the same conditions you did in the first if-else statement except using "item" instead of "size", and returning 1 if they are not equal. After the loop block, return 2 if they are equal (the inequality conditions in the upper blocks are not true.
Next, create a method that calls the function you created to compare the lists. You will also need a boolean variable that you will use as a condition in the case that the player has selected the wrong sequence of squares - set to false in global properties.
In this method, create an if-else statement, and drag the function you created after if, using the logic statement "= 1" (the 2 lists are unequal and have returned "1", as stated in your function). If this is the case, set your variable for wrong selection = true, and call the method you created for what happens if the player made the wrong selection.
If the condition is not true, have the program go back to the beginning method so Simon can continue with the game.
Does that make sense?
Hope it helps. If you have any questions, post again - I'll be checking your post.
Take care,
Todd
Last edited by todd0312; 12-08-2011 at 06:30 AM.
|