Computer Science Canada Help on how to do User Input for Simon Says Game |
Author: | unicorn-ellie [ Thu Jan 02, 2014 11:35 pm ] | ||
Post subject: | Help on how to do User Input for Simon Says Game | ||
Hi, it's me again. I've been wondering how to code the user input for the Simon Says game... So like, after the colours flash, the user gets to click on the colours and follow the pattern. If they do it correctly, the user moves onto the next level/wins. If not, they lose. Is there a way to code the user input? I've rack-sacked my brain for idea, but I just don't know how to do it. Because the pattern is always random each time you play it, I simply cannot use if statements for the colours in general... Here is the 3rd/final level of the game:
It would be great help if you explain to me how to code the user input part of this program. I'm sorry if I caused any inconvenience to you. Thank you! P.S: For those who do not know Simon Says, this is the game: http://www.freegames.ws/games/kidsgames/simon/simon.htm |
Author: | np_123 [ Fri Jan 03, 2014 2:38 am ] |
Post subject: | RE:Help on how to do User Input for Simon Says Game |
Okay, so to begin, you do not need and should not include the variable declarations that you have at the beginning of your code. I dont think your procedure level3RandomFlashing should be included as a procedure or a function. You can instead declare and initialize the variable square inside your for loop and set it equal to Rand.Int (1,8) About the 'randomness' of the pattern, I suggest you find a way to store the order of the colours flashing in the pattern, probably in an array, so you can refer to it later To get user input, I would suggest a combination of mouse.where and maybe whatdotcolour to detect the colour of the pixel where the mouse is located when you click. I do not have experience with whatdotcolour, but I would say that using it would work for your purpose, because it detects the colour of a pixel at a certain location. I will preferably leave it to someone with experience with whatdotcolour to either promote or discourage its use in this situation |