Computer Science Canada Buttons and Storing data from randint commands |
| Author: | Gaming Lyfe [ Wed Dec 23, 2015 10:12 am ] |
| Post subject: | Buttons and Storing data from randint commands |
procedure intro cls locate (4, 17) put "Welcome to Simon Says, a game where memory is key!" locate (6, 18) put "Remember the colours and their order! Good Luck!" locate (12, 23) put "Press the Menu button to continue." end intro proc instruct cls locate (4, 7) put "In Simon Says, there is a colour wheel that contains eight sections." locate (6, 14) put "Eight colours will flash in eight random positions!" locate (8, 10) put "Remember the clockwise order of which colours flash to win!" end instruct procedure simonSays var pickedAlready : array 1 .. 8 of boolean var randSpace, counter, randColor, coloring, space : int := 0 cls drawoval (400, 175, 125, 125, black) drawline (400, 175, 525, 175, black) drawline (400, 175, 275, 175, black) drawline (400, 175, 400, 300, black) drawline (400, 175, 400, 50, black) drawline (400, 175, 488, 263, black) drawline (400, 175, 315, 85, black) drawline (400, 175, 314, 264, black) drawline (400, 175, 488, 85, black) for i : 1 .. 8 pickedAlready (i) := false end for loop randint (randColor, 1, 8) if randColor = 1 then coloring := 14 %Yellow elsif randColor = 2 then coloring := 12 %Red elsif randColor = 3 then coloring := 10 %Green elsif randColor = 4 then coloring := 13 %Pink elsif randColor = 5 then coloring := 35 %Purple elsif randColor = 6 then coloring := 42 %Orange elsif randColor = 7 then coloring := 76 %Light Blue elsif randColor = 8 then coloring := 1 %Blue end if randint (randSpace, 1, 8) if pickedAlready (randSpace) = false then if randSpace = 1 then drawfill (425, 225, coloring, black) delay (1000) drawfill (425, 225, white, black) elsif randSpace = 2 then drawfill (450, 180, coloring, black) delay (1000) drawfill (450, 180, white, black) elsif randSpace = 3 then drawfill (450, 170, coloring, black) delay (1000) drawfill (450, 170, white, black) elsif randSpace = 4 then drawfill (425, 125, coloring, black) delay (1000) drawfill (425, 125, white, black) elsif randSpace = 5 then drawfill (375, 125, coloring, black) delay (1000) drawfill (375, 125, white, black) elsif randSpace = 6 then drawfill (350, 180, coloring, black) delay (1000) drawfill (350, 180, white, black) elsif randSpace = 7 then drawfill (350, 170, coloring, black) delay (1000) drawfill (350, 170, white, black) elsif randSpace = 8 then drawfill (375, 225, coloring, black) delay (1000) drawfill (375, 225, white, black) end if counter += 1 pickedAlready (randSpace) := true end if exit when counter = 8 end loop end simonSays proc ssAnswers locate(2,5) put"In which clockwise order did the colours flash?" end ssAnswers ssAnswers Im not sure what to do to get the answers, because i haven't stored all the colors that flashed. intro var button1 : int := GUI.CreateButton (290, 20, 0, "Instructions", instruct) var button2 : int := GUI.CreateButton (295, 50, 0, "Play Game", simonSays) loop exit when GUI.ProcessEvent end loop |
|
| Author: | Insectoid [ Wed Dec 23, 2015 8:15 pm ] |
| Post subject: | RE:Buttons and Storing data from randint commands |
Quote: Im not sure what to do to get the answers, because i haven't stored all the colors that flashed.
Maybe that's your problem! |
|
| Author: | Gaming Lyfe [ Thu Dec 24, 2015 9:03 am ] |
| Post subject: | RE:Buttons and Storing data from randint commands |
Ohhhhhh so i could make a variable like color1 and do somethign such as color1:=color Thanks! |
|
| Author: | Gaming Lyfe [ Sat Dec 26, 2015 6:30 pm ] |
| Post subject: | RE:Buttons and Storing data from randint commands |
What about the buttons? I need help with the buttons!!!!! |
|
| Author: | Insectoid [ Sat Dec 26, 2015 7:57 pm ] |
| Post subject: | RE:Buttons and Storing data from randint commands |
What's the problem you're having? |
|