Computer Science Canada Question About Sequences and Buttons |
Author: | sakib15 [ Sun Jan 20, 2008 1:29 pm ] |
Post subject: | Question About Sequences and Buttons |
Hello folks. I've been working on a project that's due soon at my high school, and it is a memory game consisting of a breadboard and 3 LED's. The user clicks a level of difficulty, the 3 LED's blink in any random order through the parallel ports and then the user has to match that sequence by clicking a separate section of buttons which are coloured RED, YELLOW and GREEN. I get the concept of using the keyboard to match the sequence...but i'm having issues matching the sequences by the user clicking the order of boxes. Is there a 'get' command for a click? Since there is a 'get' command for a string...i can do the keyboard matching sequence easily. By the way, i'm storing the sequences in an array. For ex. for count : 1 .. 5 randint (z (count), 1, 3) if z(count) = 3 then parallelput (8) % This is 2^3 = 8 delay (500) parallelput (0) delay (500) elsif z(count) = 2 or z(count) = 3 then parallelput (z(count)) delay (500) parallelput (0) delay (500) end if end for and to match the sequence via a keyboard would be something like... if count = 4 then put "What was the order of blinks (Red-1, Yellow-2, Green-3)" for i : 1 .. 4 get answer if answer = z(i) then put "Correct" else put "Incorrect" end if end for end if My main question is how the hell do i match the random sequence via buttons? Any help would be appreciated... |
Author: | BigBear [ Mon Mar 03, 2008 11:08 am ] | ||||
Post subject: | Re: Question About Sequences and Buttons | ||||
To get a click from the mouse use
So x is equal to the x location of the mouse and y is where the mouse is vertically. Button is if a button is being pressed (no button being pressed is 0) If the mouse is greater than 0 then you know they clicked the mouse.
|