Computer Science Canada Combo Prog |
Author: | crazygurl [ Sat Apr 09, 2005 1:59 pm ] |
Post subject: | Combo Prog |
I have this problem with my program, I have my program set up where it opens to a screen that lets the player pick whether they want to play game one or two. When the player picks game one they can play it but when the game is done my menu screen where the player can pick the game they want to play doesnt come up. is there a way i can fix this i need ideas!!! [/code]var blank := chr (32) var clubs := chr (5) var musics := chr (14) var smiley := chr (1) var heart := chr (3) var diamonds := chr (4) %%%% MAIN PROGRAM %%%% proc game1 loop var number : int var count : int := 1 var guess : int setscreen ("graphics:vga") setscreen ("nocursor") cls locate (12,36) color (2) put "WELCOME TO NUMBERS" locate (16,39) color (12) put " ", chr (1),chr (1), "ENJOY", chr (1), chr (1)," " drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) delay (6000) cls loop locate (12,20) put" Are You Ready To Play This Game? (y orn):".. drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) var ans: string (1) get ans if ans not= "y"then cls put " THANK YOU FOR PLAYING, IF YOU WANT TO PLAY AGAIN RE_RUN PROG" delay (600) exit end if color (3) put "The computer has picked a number between 1 and 100" put " " put "See if u can guess what it is" put "" randomize randint (number, 1, 100) loop color (5) put "Please enter your guess -> " .. get guess if guess = number then cls locate (16,34) color (2) put" ", chr (1), chr (15), "YOUR AWESOME",chr (15),chr (1)," " if count = 1 then locate (17,32) color (14) put "YOU GOT IT IN ", count, " TRY!!" elsif count > 1 then locate (18,25) color (9) put "YOU TOOK ", count, " TRIES TO GET THE NUMBER" end if color (13) locate ( 19,34) put "THE NUMBER WAS ", number end if if guess > number then color (4) put "You're guess is too high!" elsif guess < number then color (2) put "You're guess is too low!" end if count := count + 1 exit when guess=number end loop drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) color (3) end loop end loop cls end game1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% SPEEDY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% procedure smile (row, column: int, symbol:string(1)) locate (row,column) put repeat (smiley,1).. end smile procedure hearts (row, column:int, symbol: string (1)) locate (row,column) put repeat (heart,1) end hearts procedure diamond (row, column: int, symbol: string(1)) locate (row, column) put repeat (diamonds,1) end diamond procedure club (row, column: int, symbol:string (1)) locate (row,column) put repeat (clubs,1) end club procedure music (row, column: int, symbol:string (1)) locate (row,column) put repeat (musics,1) end music procedure animate (Time, column:int, procedure shape (row, column: int, symbol: string (1)), answer: string(1), var win: boolean ) var finished: boolean:=false var input: string (1) setscreen ("nocursor") setscreen ("noecho") win:=false for line: 8..17 if hasch then getch (input) if input=answer then win:=true end if finished :=true end if delay (Time) shape (line, column, blank) exit when finished end for end animate % % % proc game2 loop setscreen ("graphics:vga") cls locate (2, 36) Text.Color (brightred) put "Speedy!!!!!" drawbox (245, 440, 398, 465, 14) drawbox (245 - 2, 440 - 2, 398 + 2, 465 + 2, 11) drawbox (245 - 4, 440 - 4, 398 + 4, 465 + 4, 10) drawbox (245 - 6, 440 - 6, 398 + 6, 465 + 6, 12) Text.Locate (15,30) put" Welcome To Madi's Progam" drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) delay (700) cls colorback (black) randomize loop cls locate (12,20) put" Are You Ready To Play This Game? (y orn):".. drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) var ans: string get ans if ans not= "y" then cls put " RE_RUN" delay (660) exit end if color (green) locate (14,20) put "Enter Your First Name:".. drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) var firstName:string get firstName cls locate (2,32) color (9) put " Welcome ", firstName drawbox (200, 440, 438, 465, 14) drawbox (200 - 2, 440 - 2, 438 + 2, 465 + 2, 11) drawbox (200 - 4, 440 - 4, 438 + 4, 465 + 4, 10) drawbox (200- 6, 440 - 6, 438 + 6, 465 + 6, 12) locate (6,1) color (10) put "This game is unique so you will need to know all about it!! :" color (3) locate (8,1) put " There will be different shapes falling from the top of your screen, the object" locate (9,1) put "of the game is to press the key on the keyboard that coresponds to the figure" locate (10,1) put" falling from the screen." color (14) locate (12,1) put " Here is a list of the figures and thier corresponding button:" locate (13,1) put "If you see a smiley face press the S key (Smiley=S)" locate (14,1) put " If you see a heart then press the H key (Heart=H)" locate (15,1) put " If you see a club then press the C key (Club=C)" locate (16,1) put " If you see a diamond then press the D key (Dimaond=D)" locate (17,1) put " If you see a music note then press the M key (Music=M)" locate (19,1) color (red) put " You will need to memorize these commands before you can play the game!!" locate (21,1) color (13) put " This next feature is very important to your success and will reflect the skill" locate (22,1) put" level you have achieved. The delay time determines how fast objects will fall" locate (23,1) put "Note: 35-50 is a fast delay time (objects move fast) and 50-150 is a slow one" var win: boolean color (green) var amount:int var count:=0 locate (25,15) color (15) put " choose a delay time for animation:".. get amount var final: string final:= " " cls loop var column: int randint (column,4,76) var spook:int randint (spook,1, 5) case spook of label 1: animate (amount, column, smile, "s", win) label 2: animate (amount, column, hearts, "h", win) label 3: animate (amount, column, diamond, "d", win) label 4: animate (amount, column, music, "m", win) label 5: animate (amount, column, club, "c", win) end case if win then count:= count+1 else exit end if if count=1 then cls delay (400) locate (1,32) color (9) put "you reached level 1" drawbox (200, 440, 438, 465, 14) drawbox (200 - 2, 440 - 2, 438 + 2, 465 + 2, 11) drawbox (200 - 4, 440 - 4, 438 + 4, 465 + 4, 10) drawbox (200- 6, 440 - 6, 438 + 6, 465 + 6, 12) end if if count=1 then cls delay (400) put "you reached level 2".. end if if count=3 then cls delay (400) put " you reached level 3" end if if count=4 then cls put " you reached level 4" end if if count=5 then cls put " CONGRATS, YOU HAVE WON A MILLION DOLLARS...." delay (2000) cls put " NOT......THANKS FOR PLAYING COME BACK SOON" exit end if locate (1,2) put " You have got ", count, " shapes correct" drawbox (200, 440, 438, 465, 14) drawbox (200 - 2, 440 - 2, 438 + 2, 465 + 2, 11) drawbox (200 - 4, 440 - 4, 438 + 4, 465 + 4, 10) drawbox (200- 6, 440 - 6, 438 + 6, 465 + 6, 12) end loop end loop end loop end game2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%% CHOOSING PROGRAM OPENING SCREEN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% setscreen ("graphics:vga") locate (10, 25) color (5) put " ", chr (15), chr (1), " WELCOME TO MADISON'S PROGRAM", chr (1), chr (15)," " locate ( 12,18) color (4) put " In this program there are two games that you have" locate (13,18) put " the choice of playing. Game number 1 is a number" locate (14,18) put "guessing game where the computer randomly picks" locate (15,18) put " a number and you guess it. Game 2 is called SPEED" locate (16,18) put " ,in this game shapes fall from the screen and you" locate (17,18) put " must hit the key that corresponds to the shape." locate (19,38) color (2) put " ENJOY!" drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) delay (15000) cls loop var sel : int locate (10,20) color (4) put " GAME 1= NUMBER GUESSING GAME" locate (12,20) color (4) put " GAME 2= SPEED, SHAPES FALL DOWN THE SCREEN" locate (15,20) color (3) put "what game do you want to play?".. locate (16,20) put"(type 1 for game 1 and 2 for game 2" drawbox (138,158,maxx-100,maxy-120,12) drawbox (136, 156,maxx-98,maxy-118,14) drawbox (134, 154,maxx-96,maxy-116,11) drawbox (132, 152,maxx-94,maxy-114,17) drawbox (130, 150,maxx-92,maxy-112,10) drawbox (128, 148,maxx-90,maxy-110,13) drawbox (126, 146,maxx-88,maxy-108,15) get sel if sel = 1 then game1 elsif sel = 2 then game2 end if end loop |
Author: | Delos [ Sat Apr 09, 2005 4:09 pm ] |
Post subject: | |
1) Please learn to use tags properly. (The smilies at random locations atest to this...) 2) This is the Turing Submissions Forum, not Turing Help. 3) If you're going to ask for help, please post only relevant code. Sifting through heaps of code is nothing anyone likes to do. You might get some help for now since you're new here, but kindly ask a mod to have this thread moved. (Also fix it up a bit...) |
Author: | jamonathin [ Sat Apr 09, 2005 8:31 pm ] |
Post subject: | |
Also, whats's the point in copy and pasting it if you're just going to upload it onto your post anyways? |
Author: | Delos [ Sun Apr 10, 2005 8:08 am ] |
Post subject: | |
Learning experience? ![]() |
Author: | AsianSensation [ Sun Apr 10, 2005 10:15 am ] |
Post subject: | |
First, post in the right forum next. Moved. Second, this is getting annoying. You've posted this help topic 4 or 5 times alreaddy, and everytime someone answers, you start up a new thread asking the SAME question! Look, it's already been answered here: http://www.compsci.ca/v2/viewtopic.php?t=8382 I've answered your question and found what's wrong with the program, it's just up to you to remove some lines. If I see anymore of this, I'm going to have to take some actions. |