Computer Science Canada Big Shot |
Author: | r.m_spy [ Sat Apr 19, 2008 6:18 pm ] |
Post subject: | Big Shot |
var x,y,q,w,btn,score,life,tim,h,o,p,r:int tim:=0 r:=20 h:=100 life:=3 score:=0 var k:array char of boolean var s:char:=chr(32) randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) procedure game1 setscreen("graphics:max,max") put" year:2234" put"reporter: today is the day we go live to find out what mr. welder has invented." put"mr. welder: using nanobots, I have invwented a robot, painted like a smily face." put"it can preform tasks for you beacaise it is really smart." put"" put" year:2257" put"reporter: news flash. mr. walders invention has gone mad! smily's wreak town." put" you: you know, it would give me fortune if I shot all the smily's. all right I'll go." Input.Pause cls loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 end loop cls if score<5 then put"you shot 1 or two but in the end, smiley's rule the earth" elsif score>14 then put"nice work. the swat team was able to kill the rest of the smiley's" else put"okay job. you kept them in the box but were not sucsess enough to capture them " end if put"your score is ", score tim:=0 r:=20 h:=100 life:=3 score:=0 end game1 procedure adgame setscreen("graphics:max,max") put" year:2234" put"reporter: today is the day we go live to find out what mr. welder has invented." put"mr. welder: using nanobots, I have invwented a robot, painted like a smily face." put"it can preform tasks for you beacaise it is really smart." put"" put" year:2257" put"reporter: news flash. mr. walders invention has gone mad! smily's wreak town." put" you: you know, it would give me fortune if I shot all the smily's. all right I'll go." Input.Pause cls loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 or score>4 end loop if score>4 then cls put"Nice job on the first one, but the smiley's are getting smarter. Do not shoot the decoys" Input.Pause cls loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(o,p,5,5,66) drawfillbox(o+2,p+2,o+3,p+3,black) drawfillbox(o-2,p+2,o-3,p+3,black) drawfillbox(o+3,p-2,o-3,p-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 or score>9 end loop if score>9 then cls put"the smiley are escaping. kill them all! don't let them go off the screen!" Input.Pause cls randint(q,100,maxx-100) randint(w,100,maxy-100) loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) if q>maxx div 2 then q:=q+2 elsif q<maxx div 2 then q:=q-2 end if if w>maxy div 2 then w:=w+2 elsif w<maxy div 2 then w:=w-2 end if Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if if q>maxx or q<0 or w>maxy or w<0 then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx-100) randint(w,100,maxy-100) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 or score>14 end loop if score>14 then cls put"you're hunting the original smiley but he has tricks up his sleeve." put"1) he is hiding in a yellow backround. he may be harder to see" put"2) he has disabled you're aiming system. try to aim at him with your mouse!" put"3) he has 5 lives, and each time he gets smaller" Input.Pause cls loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,yellow,black) drawfill(maxx-150,maxy div 2,yellow,black) drawfill(maxx div 2,1,yellow,black) drawfill(maxx div 2,maxy-1,yellow,black) drawfilloval(q,w,r,r,yellow) drawfillbox(q+2*r,w+2*r,q+3*r,w+3*r,black) drawfillbox(q-2*r,w+2*r,q-3*r,w+3*r,black) drawfillbox(q+3*r,w-2*r,q-3*r,w-3*r,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) h:=h-5 r:=r-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 or score>18 end loop end if end if end if tim:=0 r:=20 h:=100 life:=3 score:=0 end adgame procedure game2 loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(o,p,5,5,66) drawfillbox(o+2,p+2,o+3,p+3,black) drawfillbox(o-2,p+2,o-3,p+3,black) drawfillbox(o+3,p-2,o-3,p-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 end loop tim:=0 r:=20 h:=100 life:=3 score:=0 end game2 procedure game3 loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,blue,black) drawfill(maxx-150,maxy div 2,blue,black) drawfill(maxx div 2,1,brightgreen,black) drawfill(maxx div 2,maxy-1,blue,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) drawline(100,0,100,maxy,black) if q>maxx div 2 then q:=q+2 elsif q<maxx div 2 then q:=q-2 end if if w>maxy div 2 then w:=w+2 elsif w<maxy div 2 then w:=w-2 end if Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if if q>maxx or q<0 or w>maxy or w<0 then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx-100) randint(w,100,maxy-100) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 end loop tim:=0 r:=20 h:=100 life:=3 score:=0 end game3 procedure game4 r:=5 loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,yellow,black) drawfill(maxx-150,maxy div 2,yellow,black) drawfill(maxx div 2,1,yellow,black) drawfill(maxx div 2,maxy-1,yellow,black) drawfilloval(q,w,r,r,yellow) drawfillbox(q+2*r,w+2*r,q+3*r,w+3*r,black) drawfillbox(q-2*r,w+2*r,q-3*r,w+3*r,black) drawfillbox(q+3*r,w-2*r,q-3*r,w-3*r,black) drawline(100,0,100,maxy,black) Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx) randint(w,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx) randint(w,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 end loop tim:=0 r:=20 h:=100 life:=3 score:=0 end game4 procedure game5 loop delay(100) cls Mouse.Where(x,y,btn) put"Score :",score put"lives :",life put"Time :",tim,"/",h drawline(100,0,100,maxy,black) drawline(100,0,maxx div 2-50,maxy div 2-50,black) drawline(100,maxy,maxx div 2-50,maxy div 2+50,black) drawline(maxx,0,maxx div 2+50,maxy div 2-50,black) drawline(maxx,maxy,maxx div 2+50,maxy div 2+50,black) drawfillbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,grey) drawbox(maxx div 2-50,maxy div 2-50,maxx div 2+50,maxy div 2+50,black) drawfill(150,maxy div 2,yellow,black) drawfill(maxx-150,maxy div 2,yellow,black) drawfill(maxx div 2,1,yellow,black) drawfill(maxx div 2,maxy-1,yellow,black) drawfilloval(q,w,5,5,yellow) drawfillbox(q+2,w+2,q+3,w+3,black) drawfillbox(q-2,w+2,q-3,w+3,black) drawfillbox(q+3,w-2,q-3,w-3,black) drawfilloval(o,p,5,5,66) drawfillbox(o+2,p+2,o+3,p+3,black) drawfillbox(o-2,p+2,o-3,p+3,black) drawfillbox(o+3,p-2,o-3,p-3,black) drawline(100,0,100,maxy,black) if q>maxx div 2 then q:=q+2 elsif q<maxx div 2 then q:=q-2 end if if w>maxy div 2 then w:=w+2 elsif w<maxy div 2 then w:=w-2 end if if o>maxx div 2 then o:=o+2 elsif q<maxx div 2 then o:=o-2 end if if p>maxy div 2 then p:=p+2 elsif w<maxy div 2 then p:=p-2 end if Input.KeyDown(k) if tim>h or tim=h then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if if q>maxx or q<0 or w>maxy or w<0 then life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if if k(s) then if x>q-5 and x<q+5 and y>w-5 and y<w+5 then score:=score+1 randint(q,100,maxx-100) randint(w,100,maxy-100) randint(o,100,maxx) randint(p,0,maxy) h:=h-5 tim:=0 delay(200) else life:=life-1 randint(q,100,maxx-100) randint(w,100,maxy-100) randint(o,100,maxx) randint(p,0,maxy) tim:=0 delay(200) end if end if tim:=tim+1 exit when life<0 end loop tim:=0 r:=20 h:=100 life:=3 score:=0 end game5 procedure controls setscreen("graphics:max,max") loop delay(100) cls put"use your mouse to aim. try it out. press the spacebar to continue" Mouse.Where(x,y,btn) drawfilloval(x,y,5,5,brightred) drawline(x,0,x,maxy,black) drawline(0,y,maxx,y,black) Input.KeyDown(k) exit when k(s) end loop cls put" your Score" put"lives left" put" time/total time" drawline(150,0,150,maxy,black) Input.Pause cls put"press spacebar to shoot. press anything to exit" Input.Pause cls end controls game2 |
Author: | jernst [ Sat Apr 19, 2008 6:50 pm ] |
Post subject: | Re: Big Shot |
code tags! |
Author: | StealthArcher [ Sat Apr 19, 2008 6:52 pm ] |
Post subject: | RE:Big Shot |
Procedures! |
Author: | Sean [ Sun Apr 20, 2008 9:07 am ] |
Post subject: | Re: Big Shot |
Shorter Code! |
Author: | StealthArcher [ Sun Apr 20, 2008 2:30 pm ] |
Post subject: | RE:Big Shot |
Barret's first Limit Break! |
Author: | Sean [ Sun Apr 20, 2008 5:02 pm ] |
Post subject: | Re: Big Shot |
For Loops are required! |
Author: | StealthArcher [ Sun Apr 20, 2008 5:17 pm ] |
Post subject: | RE:Big Shot |
Fruit Loops are optional! |
Author: | darkangel [ Sun Apr 20, 2008 5:29 pm ] |
Post subject: | Re: RE:Big Shot |
StealthArcher @ Sun Apr 20, 2008 5:17 pm wrote: Fruit Loops are optional!
lulz |
Author: | Clayton [ Sun Apr 20, 2008 7:33 pm ] |
Post subject: | RE:Big Shot |
This is turning rather spammy. Either make sensible posts, or this topic is risking lockage. |
Author: | Sean [ Sun Apr 20, 2008 7:57 pm ] |
Post subject: | RE:Big Shot |
ALright a serious post.. You can fix alot of your ovals, by using a for loop. That shall lower the line count of your code, and make it more efficent. |
Author: | StealthArcher [ Sun Apr 20, 2008 8:20 pm ] |
Post subject: | RE:Big Shot |
Check for areas where your code, with exception of values, does the same thing, try putting it into a procedure. |
Author: | Tallguy [ Tue Apr 22, 2008 8:39 am ] |
Post subject: | RE:Big Shot |
zip it next timw |
Author: | crysis [ Tue Apr 22, 2008 8:35 pm ] |
Post subject: | RE:Big Shot |
its messed up for me and does not work |
Author: | syntax_error [ Tue Apr 22, 2008 9:21 pm ] |
Post subject: | Re: RE:Big Shot |
Tallguy @ Tue Apr 22, 2008 8:39 am wrote: zip it next timw
Why on Earth would he do that, its simply source code, no other files. Please think before you post, everywhere. |
Author: | Tallguy [ Tue May 06, 2008 9:05 am ] |
Post subject: | RE:Big Shot |
its easier then copying his code into turing, saves room on a single forum page too |
Author: | Prince Pwn [ Tue May 13, 2008 8:26 am ] |
Post subject: | RE:Big Shot |
It's pretty sweet looking, you should make it double buffer by using View.Set("graphics;offscreenonly") at the top of your proggy, then View.Update within the proggy. |