Computer Science Canada Color Wheel Game |
Author: | Gaming Lyfe [ Mon Dec 21, 2015 2:23 pm ] |
Post subject: | Color Wheel Game |
I am trying to create a program where i have a color wheel with eight sections. I want eight different colors to flash in random sections in a random order. However, i am not sure how to make the program so that every position only flashes once. I have tried using if's to color over each position in white once it has flashed but it hasn't worked. P.S. Entering and running the code may help explain what I am trying to do. var randSpace, randColor, coloring, space : int 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) loop randint (randSpace, 1, 8) 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 := 36 %Pink elsif randColor = 5 then coloring := 34 %Purple elsif randColor = 6 then coloring := 42 %Orange elsif randColor = 7 then coloring := 11 %Light Blue elsif randColor = 8 then coloring := 32 %Blue end if 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(450,170,coloring,black) delay(1000) drawfill(450,170,white,black) elsif randSpace = 8 then drawfill(375,225,coloring,black) delay(1000) drawfill(375,225,white,black) end if end loop Also, I am using buttons in my code, but i cant seem to get them to work. Here is a peice of code i made. Why wont it work? procedure menu cls GUI.Hide(menuButton) put"Ur a Fricking Genius" end menu procedure intro locate(5,17) put"Welcome to Simon Says, a game where memory is key!" locate(7,18) put"Remember the colours and their order! Good Luck!" locate(20,1) put" Press the Menu Button to continue." menuButton := GUI.CreateButton (500, 50, 0, "Menu", menu) end intro intro I am currently using the newest version of Turing. If you could respond and help me out, that would be great!!! Thanks so much! |
Author: | Insectoid [ Mon Dec 21, 2015 6:21 pm ] |
Post subject: | RE:Color Wheel Game |
This is a lot like shuffling a deck of cards. There are many shuffling tutorials in both the tutorials section and the help section. You can also look up shuffling algorithms on Google or Wikipedia. |
Author: | Gaming Lyfe [ Tue Dec 22, 2015 12:07 pm ] |
Post subject: | RE:Color Wheel Game |
I searched for card shuffling, but i couldnt find what i was looking for. Can you help me? |
Author: | Insectoid [ Tue Dec 22, 2015 2:04 pm ] |
Post subject: | RE:Color Wheel Game |
The Fisher-Yates shuffle is extremely simple. |
Author: | Gaming Lyfe [ Tue Dec 22, 2015 5:13 pm ] |
Post subject: | RE:Color Wheel Game |
Thanks Insectoid! You have been very helpful and have helped me acquire the knowledge i need to finish my ISP! |