Computer Science Canada Help me put button for my game look at it then u will know |
Author: | ruban Sivakumar [ Fri Jun 04, 2004 9:09 pm ] |
Post subject: | Help me put button for my game look at it then u will know |
This is my game which i created. I want to put a button in the RULES page which would lead to the actual game start. I tried so many times. I wasn't able to do it. Drag to the bottom of this then you will know what i ment to do. import GUI View.Set ("graphics:600;500;nobuttonbar;Title:CANADIAN GEOGRAPHY GAME") var isEng : boolean := true procedure eng1 isEng := false GUI.Quit end eng1 var font : int := Font.New ("Arial:15") Font.Draw ("CANADIAN GEOGRAPHY GAME", 150, 450, font, green) delay (500) var fonts : int := Font.New ("Algerian:20") var mypic : int := Pic.FileNew ("A:/canada2.bmp") Pic.Draw (mypic, 130, 100, 0) delay (500) var mypic1 : int := Pic.FileNew ("A:/12.bmp") Pic.Draw (mypic1, 10, 425, 0) delay (500) var mypic2 : int := Pic.FileNew ("A:/12.bmp") Pic.Draw (mypic2, 10, 5, 0) delay (500) var mypic4 : int := Pic.FileNew ("A:/12.bmp") Pic.Draw (mypic4, 470, 425, 0) delay (500) var mypic3 : int := Pic.FileNew ("A:/12.bmp") Pic.Draw (mypic3, 470, 5, 0) delay (500) var mypic7 : int := Pic.FileNew ("A:/3.bmp") Pic.Draw (mypic7, 25, 360, 0) delay (500) var mypic8 : int := Pic.FileNew ("A:/4.bmp") Pic.Draw (mypic8, 490, 360, 0) delay (500) var mypic6 : int := Pic.FileNew ("A:/2.bmp") Pic.Draw (mypic6, 25, 290, 0) delay (500) var mypic9 : int := Pic.FileNew ("A:/5.bmp") Pic.Draw (mypic9, 490, 290, 0) delay (500) var mypic5 : int := Pic.FileNew ("A:/1.bmp") Pic.Draw (mypic5, 25, 220, 0) delay (500) var mypic10 : int := Pic.FileNew ("A:/6.bmp") Pic.Draw (mypic10, 490, 220, 0) delay (500) var mypic100 : int := Pic.FileNew ("A:/11.bmp") Pic.Draw (mypic100, 25, 150, 0) delay (500) var mypic11 : int := Pic.FileNew ("A:/7.bmp") Pic.Draw (mypic11, 490, 150, 0) delay (500) var mypic12 : int := Pic.FileNew ("A:/8.bmp") Pic.Draw (mypic12, 25, 80, 0) delay (500) var mypic13 : int := Pic.FileNew ("A:/9.bmp") Pic.Draw (mypic13, 490, 80, 0) delay (500) var mypic14 : int := Pic.FileNew ("A:/10.bmp") Pic.Draw (mypic14, 140, 10, 0) delay (500) var mypic140 : int := Pic.FileNew ("A:/13.bmp") Pic.Draw (mypic140, 255, 10, 0) delay (500) var mypic1400 : int := Pic.FileNew ("A:/14.bmp") Pic.Draw (mypic1400, 370, 10, 0) delay (500) var eng : int := GUI.CreateButton (150, 80, 0, " Start the Game ", GUI.Quit) delay (500) var eng2 : int := GUI.CreateButton (350, 80, 1, " Rules ", eng1) loop exit when GUI.ProcessEvent end loop cls if isEng = true then % i want these all these information to come when you click the START THE GAME in the %main page and when you enter the RULES pages there is a button which i want to put down all the information. var x : int := 5 setscreen ("graphics:600;500;nobuttonbar;Title:WELCOME TO CANADIAN GEOGRAPHY GAME") var fonts1 : int := Font.New ("Algerian:20") Font.Draw ("Welcome to Canadian Geography Game", 30, 450, fonts1, 1) loop drawfillmapleleaf (250 - x, 1 + x, 200 + x + x, 100 + x + x, red) drawmapleleaf (250 - x, 1 + x, 200 + x + x, 100 + x + x, 0) drawfillmapleleaf (300 - x, 1 + x, 150 + x + x, 100 + x + x, red) drawmapleleaf (300 - x, 1 + x, 150 + x + x, 100 + x + x, 0) drawfillmapleleaf (350 - x, 1 + x, 100 + x + x, 100 + x + x, red) drawmapleleaf (350 - x, 1 + x, 100 + x + x, 100 + x + x, 0) drawfillmapleleaf (400 - x, 1 + x, 50 + x + x, 100 + x + x, brightred) drawmapleleaf (400 - x, 1 + x, 50 + x + x, 100 + x + x, 0) delay (25) x += 1 exit when x = 150 end loop delay (999) cls setscreen ("graphics:600;500;nobuttonbar;Title:LEVEL 1") var fonts10 : int := Font.New ("Lucida Blackletter:100") Font.Draw ("Level 1", 100, 250, fonts10, 1) delay (800) cls var fonts99 : int := Font.New ("Arial:20") Font.Draw ("PROVINCE WOULD BE GIVEN, YOUR JOB IS ", 10, 450, fonts99, 1) delay (555) var fonts91 : int := Font.New ("Arial:20") Font.Draw ("TO FIND THE CAPITAL CITY", 150, 300, fonts91, 1) delay (555) var fonts90 : int := Font.New ("Arial:20") Font.Draw ("OF THAT PROVINCE", 200, 150, fonts90, 1) delay (9995) cls var mypic00 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic00, 80, 10, 0) var x1 : int := 5 var muli, score : int score := 0 put "1. What is the capital city of British Columbia?" put "" put "1. Vancouver" put "2. Victoria" put "3. Prince George" put "4. Toronto" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 2 then put "WOW!! You are right" score := score + 2 put "Total Points: " .. put score else put "Sorry you are wrong. Do your best on the other questions." end if delay (999) cls var mypic22 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic22, 80, 10, 0) put "2. What is the capital city of Alberta?" put "" put "1. Calgary" put "2. Banff" put "3. Edmonton" put "4. Grande Prairie" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 3 then put "Bravo. You are right" score := score + 2 put "Total Points: " .. put score else put "Sorry you got that one wrong" end if delay (999) cls var mypic23 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic23, 80, 10, 0) put "3. What is the capital city of Saskatchewan?" put "" put "1. Regina" put "2. Saskatoon" put "3. Prince Albert" put "4. Yorkton" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 1 then put "Wow!! How did you know that one" score := score + 2 put "Total Points: " .. put score else put "The answer you gave is wrong. Just do best on the other question" end if delay (999) cls var mypic24 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic24, 80, 10, 0) put "4. What is the capital city of Manitoba?" put "" put "1. Thompson" put "2. Dauphia" put "3. Brandon" put "4. Winnipeg" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 4 then put "Brilliant. You are correct" score := score + 2 put "Total Points: " .. put score else put "You are wrong. Keep up the good work" end if delay (999) cls var mypic25 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic25, 80, 10, 0) put "5. What is the capital city of Ontario?" put "" put "1. Scarborough" put "2. Toronto" put "3 North York" put "4. Montreal" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 2 then put "Bravo. You are correct" score := score + 2 put "Total Points: " .. put score else put "Sorry you got that one wrong" end if delay (999) cls var mypic26 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic26, 80, 10, 0) put "6. What is the capital city of Quebec?" put "" put "1. Quebec City" put "2. Montreal" put "3. Cornwall" put "4. Ottawa" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 1 then put "You are right. Keep up the good work" score := score + 2 put "Total Points: " .. put score else put "You are wrong. Just do good on the other questions" end if delay (999) cls var mypic27 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic27, 80, 10, 0) put "7. What is the capital city of Newfoundland and Labrodor?" put "" put "1. Labrador City" put "2. Happy Valley-Goose Bay" put "3. Halifax" put "4. St. John's" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 4 then put "WWWOOOOWWW!!You are right" score := score + 2 put "Total Points: " .. put score else put "You got that one Wrong" end if delay (999) cls var mypic28 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic28, 80, 10, 0) put "8. What is the capital city of New Brunswick?" put "" put "1. Fredericton" put "2. Moncton" put "3. New Brunswick City" put "4. Bathurst" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 1 then put "YES!!You got that one" score := score + 2 put "Total Points: " .. put score else put "NOOOO!! The answer is Fredericton" end if delay (999) cls var mypic29 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic29, 80, 10, 0) put "9. What is the capital city of Prince Edward Island?" put "" put "1. Sydney" put "2. Edward Island" put "3. Halifax" put "4. Charlottetown" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 4 then put "YES!! Keep up the good work" score := score + 2 put "Total Points: " .. put score else put "The answer you gave is wrong" end if delay (999) cls var mypic30 : int := Pic.FileNew ("A:/canada1.bmp") Pic.Draw (mypic30, 80, 10, 0) put "10. What is the capital city of Nova Scotia?" put "" put "1. Sydney" put "2. Halifax" put "3. Scotia Island" put "4. St. John's" put "" put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" get muli put "" if muli = 2 then put "Bravo. You are right" score := score + 2 put "Total Points: " .. put score else put "You are wrong" end if delay (999) cls if score >= 16 then setscreen ("graphics:600;500;nobuttonbar;Title:Geography Game=> Level 2") var ans : string var score1 : int var fonts0 : int := Font.New ("Lucida Blackletter:100") Font.Draw ("Level 2", 100, 230, fonts0, 1) delay (888) cls var fonts910 : int := Font.New ("Arial:15") Font.Draw ("TYPE THE CORRECT PROVINCE FOR EACH CAPITAL CITY", 20, 250, fonts910, 1) delay (999) cls score1 := 0 put "" put "" put "1. In which province is Victoria located?" put "" get ans : * put "" if ans = "British Columbia" then put "WOOW!! You are right" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "Do good on the other questions" end if delay (999) cls put "" put "" put "2. In which province is Edmonton located?" put "" put "" get ans : * put "" if ans = "Alberta" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "3. In which province is Regina located?" put "" put "" get ans : * put "" if ans = "Saskatchewan" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "4. In which province is Winnipeg located?" put "" put "" get ans : * put "" if ans = "Manitoba" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "5. In which province is Toronto located?" put "" put "" get ans : * put "" if ans = "Ontario" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "6. In which province is Quebec City located?" put "" put "" get ans : * put "" if ans = "Quebec" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "7. In which province is St.John's located?" put "" put "" get ans : * put "" if ans = "Newfoundland" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "The correct answer is Newfoundland" end if delay (999) cls put "" put "" put "8. In which province is Fredericton located?" put "" put "" get ans : * put "" if ans = "New Brunswick" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "9. In which province is Halifax located?" put "" put "" get ans : * put "" if ans = "Nova Scotia" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls put "" put "" put "10. In which province is Charlottetown located?" put "" put "" get ans : * put "" if ans = "Prince Edward Island" then put "Bravo!! You are correct" score1 := score1 + 2 put "" put "Total Points: " .. put score1 else put "You got the answer wrong" end if delay (999) cls setscreen ("graphics:600;500;nobuttonbar;Title:SUMMARY") var total : int put "" put "LEVEL 1" put "TOTAL QUESTIONS - 10" put "TOTAL POINTS VALUE - 10" put "NUMBER OF QUESTIONS YOU GOT RIGHT - ".. put score put "YOUR SCORE IS- " .. put score put "" put "" put "LEVEL 2" put "TOTAL QUESTIONS - 10" put "TOTAL POINTS VALE - 10" put "NUMBER OF QUESTIONS YOU GOT RIGHT - ".. put score put "YOUR SCORE IS - " .. put score1 put "" put"" total := score + score1 put "FINAL TOTAL" put "TOTAL QUESTIONS(LEVEL1 + LEVEL2) - 20" put "TOTAL POINT VALUE(LEVEL1 + LEVEL2) - 20" put "" put "" put "OVERALL YOUR ACHIEVEMENT" put "TOTAL QUESTION YOU ANSWERED CORRECTLY - ".. put total..put" out of 20" put "TOTAL POINTS YOU GAINED - ".. put total..put" out of 20" else setscreen ("graphics:600;500;nobuttonbar;Title:SORRY YOU DIDN'T MAKE IT TO LEVEL 2") var fonts00 : int := Font.New ("Arial:15") Font.Draw ("SORRY. YOU DIDN'T MAKE IT TO LEVEL 2.", 100, 250, fonts00, 1) var fonts01 : int := Font.New ("Arial:15") Font.Draw ("TRY AGAIN NEXT TIME.", 200, 150, fonts01, 1) put "" put "REMINDER THAT YOU NEED ATLEAST 16 POINTS TO GO TO LEVEL2" put "" put "TOTAL POINTS GAINED IN LEVEL 1 is " .. put score end if else setscreen ("graphics:600;500;nobuttonbar;Title:Rules => Geography Game") var font1 : int := Font.New ("Arial Bold MS:25") Font.Draw ("Rules for Canadian Geography Game", 30, 250, font1, 4) delay (999) cls put "" put "" put "LEVEL 1." put "" put "1. TYPE IN THE CORRECT NUMBER FOR YOUR ANSWER." put "" put "2. YOU NEED AT LEAST 16 POINTS TO GO TO LEVEL 2." put "" put "3. IF YOU DON'T KNOW THE ANSWER JUST GUESS IT BY USING THE MAP OF CANADA" put " IN ORDER TO GO TO NEXT QUESTION." put "" put "4. 10 QUESTIONS WILL BE ASKED" put "" put "LEVEL 2." put "" put "1. TO ANSWER THE QUESTION YOU SHOULD TYPE YOUR ANSWER." put " (CAPATILIZATION COUNTS)" put "" put "2. IF YOU DON'T KNOW THE ANSWER JUST GUESS IN ORDER TO GO TO NEXT QUESTION" put "" put "4. 10 QUESTIONS WILL BE ASKED" put "" var eng10 : int := GUI.CreateButton (10, 10, 0, " Start the Game ", GUI.Quit) % i want this button to lead it toward the start game which is this part. I tried so many times but i couldn't %do it. % var x : int := 5 %setscreen ("graphics:600;500;nobuttonbar;Title:WELCOME TO CANADIAN GEOGRAPHY GAME") %var fonts1 : int := Font.New ("Algerian:20") %Font.Draw ("Welcome to Canadian Geography Game", 30, 450, fonts1, 1) %loop % drawfillmapleleaf (250 - x, 1 + x, 200 + x + x, 100 + x + x, red) % drawmapleleaf (250 - x, 1 + x, 200 + x + x, 100 + x + x, 0) % drawfillmapleleaf (300 - x, 1 + x, 150 + x + x, 100 + x + x, red) % drawmapleleaf (300 - x, 1 + x, 150 + x + x, 100 + x + x, 0) %drawfillmapleleaf (350 - x, 1 + x, 100 + x + x, 100 + x + x, red) %drawmapleleaf (350 - x, 1 + x, 100 + x + x, 100 + x + x, 0) %drawfillmapleleaf (400 - x, 1 + x, 50 + x + x, 100 + x + x, brightred) %drawmapleleaf (400 - x, 1 + x, 50 + x + x, 100 + x + x, 0) %delay (25) %x += 1 %exit when x = 150 %end loop %delay (999) %cls %setscreen ("graphics:600;500;nobuttonbar;Title:LEVEL 1") % var fonts10 : int := Font.New ("Lucida Blackletter:100") %Font.Draw ("Level 1", 100, 250, fonts10, 1) %delay (800) %cls %var fonts99 : int := Font.New ("Arial:20") %Font.Draw ("PROVINCE WOULD BE GIVEN, YOUR JOB IS ", 10, 450, fonts99, 1) %delay (555) %var fonts91 : int := Font.New ("Arial:20") %Font.Draw ("TO FIND THE CAPITAL CITY", 150, 300, fonts91, 1) %delay (555) %var fonts90 : int := Font.New ("Arial:20") %Font.Draw ("OF THAT PROVINCE", 200, 150, fonts90, 1) % delay (9995) % cls %var mypic00 : int := Pic.FileNew ("A:/canada1.bmp") %Pic.Draw (mypic00, 80, 10, 0) %var x1 : int := 5 %var muli, score : int %score := 0 %put "1. What is the capital city of British Columbia?" %put "" %put "1. Vancouver" %put "2. Victoria" %put "3. Prince George" %put "4. Toronto" %put "" %put "ANSWER(BY TYPE IN THE CORRECT NUMBER)" %get muli %etc end if |