Computer Science Canada How to import work try again buttons? |
Author: | RachelMonster [ Sun Jan 22, 2012 8:04 pm ] |
Post subject: | How to import work try again buttons? |
What is it you are trying to achieve? For the wrong answers (choose11,choose13,choose14) to have a try again button which brings them back to the previous question. What is the problem you are having? Wont let me go back to the question Describe what you have tried to solve this problem if's and more procedures Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here> [syntax="turing"] <Add your code here> %1st answer to question #1 procedure choose11 cls drawfillbox (0, 500, 800, 0, 43) drawfilloval (400, 200, 140, 140, 14) drawfillarc (400, 110, 70, 70, -360, -180, black) %mouth drawfillarc (400, 100, 75, 70, -360, -180, 14) %mouth drawfilloval (350, 230, 20, 25, black) drawfilloval (450, 230, 20, 25, black) font := Font.New ("Arial:40:bold,italic") %type of font and size var height, ascent, descent, internalLeading : int Font.Sizes (font, height, ascent, descent, internalLeading) %heights Draw.Text ("Nope, try again!", 180, 350, font, black) % Text with colour end choose11 %3rd answer to question #1 procedure choose13 cls drawfillbox (0, 500, 800, 0, 43) drawfilloval (400, 200, 140, 140, 14) drawfillarc (400, 110, 70, 70, -360, -180, black) %mouth drawfillarc (400, 100, 75, 70, -360, -180, 14) %mouth drawfilloval (350, 230, 20, 25, black) drawfilloval (450, 230, 20, 25, black) font := Font.New ("Arial:40:bold,italic") %type of font and size var height, ascent, descent, internalLeading : int Font.Sizes (font, height, ascent, descent, internalLeading) %heights Draw.Text ("Sorry, try again.", 180, 350, font, black) % Text with colour end choose13 %4th answer to question #1 procedure choose14 cls drawfillbox (0, 500, 800, 0, 43) drawfilloval (400, 200, 140, 140, 14) drawfillarc (400, 110, 70, 70, -360, -180, black) %mouth drawfillarc (400, 100, 75, 70, -360, -180, 14) %mouth drawfilloval (350, 230, 20, 25, black) drawfilloval (450, 230, 20, 25, black) font := Font.New ("Arial:40:bold,italic") %type of font and size var height, ascent, descent, internalLeading : int Font.Sizes (font, height, ascent, descent, internalLeading) %heights Draw.Text ("Boo! It's okay.", 180, 350, font, black) % Text with colour end choose14 procedure Play cls drawfillbox (0, 0, 800, 600, 53) %sky drawfilloval (400, 50, 600, 94, green) %grass %****************************SNAIL************************************ %things on the top... drawfilloval (320, 300, 5, 50, brown) drawfilloval (320, 351, 7, 7, brown) drawfilloval (350, 300, 5, 50, brown) drawfilloval (350, 351, 7, 7, brown) %head drawfilloval (340, 250, 50, 40, brown) %mouth drawfilloval (349, 235, 15, 10, black) drawfilloval (349, 238, 15, 10, brown) %left eye drawfilloval (335, 253, 11, 10, white) drawfilloval (330, 255, 4, 4, black) %right eye drawfilloval (367, 253, 11, 10, white) drawfilloval (362, 255, 4, 4, black) %neck drawfilloval (310, 160, 30, 90, brown) %body drawfillarc (220, 70, 100, 40, 0, 180, brown) drawfilloval (260, 110, 30, 30, brown) %close hole %tail drawfillarc (135, 100, 45, 30, 510, 0, brown) %shell drawfilloval (210, 170, 100, 80, black) drawfilloval (210, 170, 97, 77, 44) drawfilloval (220, 155, 80, 60, black) drawfilloval (220, 155, 77, 57, 44) drawfilloval (255, 170, 50, 55, 44) drawfilloval (220, 175, 35, 40, black) drawfilloval (220, 175, 32, 37, 44) drawfilloval (210, 186, 39, 25, 44) drawfilloval (208, 170, 23, 18, black) drawfilloval (208, 170, 20, 15, 44) drawfilloval (202, 170, 10, 12, 44) %question font := Font.New ("Arial:24:bold,italic") %type of font and size var height, ascent, descent, internalLeading : int Font.Sizes (font, height, ascent, descent, internalLeading) %heights Draw.Text ("What colour is the snails shell?", 100, 400, font, black) % Text with colour %answers var q1a1 : int := GUI.CreateButton (450, 250, 100, "Green", choose11) GUI.SetColor (q1a1, 54) var q1a2 : int := GUI.CreateButton (450, 200, 100, "Yellow", choose12) GUI.SetColor (q1a2, 54) var q1a3 : int := GUI.CreateButton (450, 150, 100, "Blue", choose13) GUI.SetColor (q1a3, 54) var q1a4 : int := GUI.CreateButton (450, 100, 100, "Purple", choose14) GUI.SetColor (q1a4, 54) end Play var a : int := GUI.CreateButton (350, 200, 100, "Play", Play) GUI.SetColor (a, 54) Please specify what version of Turing you are using 4.1 I believe |
Author: | Alex C. [ Sun Jan 22, 2012 8:19 pm ] |
Post subject: | Re: How to import work try again buttons? |
yeah, no need to double post.. *first post* oh and please use code tags... seriously, if statements should work. if correct answer= false, just keep looping it till they get the right answer |
Author: | RachelMonster [ Sun Jan 22, 2012 8:50 pm ] |
Post subject: | Re: How to import work try again buttons? |
Can you give me an example please??? |
Author: | Aange10 [ Sun Jan 22, 2012 9:07 pm ] |
Post subject: | Re: How to import work try again buttons? |
RachelMonster @ 22/1/2012, 7:50 pm wrote: Can you give me an example please???
if correct answer= false, just keep looping |
Author: | RachelMonster [ Sun Jan 22, 2012 9:17 pm ] |
Post subject: | RE:How to import work try again buttons? |
can somebody give me an example of how it would be in my program? 'cause i honestly have no idea what's happening.. |
Author: | Aange10 [ Sun Jan 22, 2012 9:20 pm ] |
Post subject: | RE:How to import work try again buttons? |
Quote: cause i honestly have no idea what's happening.. What do you want to happen |
Author: | RachelMonster [ Sun Jan 22, 2012 9:23 pm ] |
Post subject: | RE:How to import work try again buttons? |
I want choose11,choose13 and choose14 to include a try again button that brings it back to the the question (procedure Play) |
Author: | Aange10 [ Sun Jan 22, 2012 9:27 pm ] |
Post subject: | RE:How to import work try again buttons? |
Read about GUI in the Turing Walkthrough. It will explain the use of buttons. |
Author: | RachelMonster [ Sun Jan 22, 2012 9:29 pm ] |
Post subject: | RE:How to import work try again buttons? |
I did read it, im still confused |