Computer Science Canada Stack blocks |
Author: | r.m_spy [ Sun Apr 20, 2008 10:44 am ] |
Post subject: | Stack blocks |
%I have this code, but I have a few errors. can you help me out? procedure back var x:int:=0 loop drawline(x,0,x,maxy,black) x:=x+75 exit when x>maxx-75 end loop x:=0 loop drawline(0,x,maxx,x,black) x:=x+50 exit when x>maxx end loop drawfillbox(maxx-35,0,maxx,maxy,white) drawline(maxx-35,0,maxx-35,maxy,black) drawfillbox(0,maxy-50,maxx,maxy,white) drawline(0,maxy-50,maxx-35,maxy-50,black) end back var di,l,sc,q,w,o,p:int var k:array char of boolean var s:char:=chr(32) q:=35 di:=1 w:=25 l:=140 sc:=0 delay(1000) cls loop delay(150) cls back drawfillbox(q-35,w-25,q+40,w+25,brightred) if di=1 then q:=q+75 elsif di=2 then q:=q-75 end if if q>maxx-110 then di:=2 elsif q<75 then di:=1 end if Input.KeyDown(k) exit when k(s) end loop o:=q-35 p:=q+40 w:=w+50 if di=1 then di:=2 q:=q-75 elsif di=2 then di:=1 q:=q+75 end if loop delay(l) cls back drawfillbox(o,0,p,w-25,brightred) drawfillbox(q-35,w-25,q+40,w+25,brightred) if di=1 then q:=q+75 elsif di=2 then q:=q-75 end if if q>maxx-110 then di:=2 elsif q<75 then di:=1 end if Input.KeyDown(k) if k(s) then if q-35=o and q+40=p then sc:=sc+1 w:=w+50 l:=l-10 delay(1000) cls else cls put"gameover, restart" put"score is ", sc loop end loop end if end if exit when w>maxx-300 end loop cls back drawfillbox(o,0,p,w-25,brightred) |
Author: | Sean [ Sun Apr 20, 2008 12:31 pm ] |
Post subject: | RE:Stack blocks |
Would be good to use [code] tags and also, list the problems that you are encountering, so we have an idea of what we understand. |
Author: | r.m_spy [ Sun Apr 20, 2008 3:46 pm ] |
Post subject: | RE:Stack blocks |
First problem. the game's second part is not working. even if I get it on it still makes me lose! second problem.can I make the game a zip code? |
Author: | r.m_spy [ Sun Apr 20, 2008 3:47 pm ] |
Post subject: | Re: Stack blocks |
[ procedure back var x:int:=0 loop drawline(x,0,x,maxy,black) x:=x+75 exit when x>maxx-75 end loop x:=0 loop drawline(0,x,maxx,x,black) x:=x+50 exit when x>maxx end loop drawfillbox(maxx-35,0,maxx,maxy,white) drawline(maxx-35,0,maxx-35,maxy,black) drawfillbox(0,maxy-50,maxx,maxy,white) drawline(0,maxy-50,maxx-35,maxy-50,black) end back var di,l,sc,q,w,o,p:int var k:array char of boolean var s:char:=chr(32) q:=35 di:=1 w:=25 l:=140 sc:=0 delay(1000) cls loop delay(150) cls back drawfillbox(q-35,w-25,q+40,w+25,brightred) if di=1 then q:=q+75 elsif di=2 then q:=q-75 end if if q>maxx-110 then di:=2 elsif q<75 then di:=1 end if Input.KeyDown(k) exit when k(s) end loop o:=q-35 p:=q+40 w:=w+50 if di=1 then di:=2 q:=q-75 elsif di=2 then di:=1 q:=q+75 end if loop delay(l) cls back drawfillbox(o,0,p,w-25,brightred) drawfillbox(q-35,w-25,q+40,w+25,brightred) if di=1 then q:=q+75 elsif di=2 then q:=q-75 end if if q>maxx-110 then di:=2 elsif q<75 then di:=1 end if Input.KeyDown(k) if k(s) then if q-35=o and q+40=p then sc:=sc+1 w:=w+50 l:=l-10 delay(1000) cls else cls put"gameover, restart" put"score is ", sc loop end loop end if end if exit when w>maxx-300 end loop cls back drawfillbox(o,0,p,w-25,brightred) ] |
Author: | syntax_error [ Sun Apr 20, 2008 10:50 pm ] |
Post subject: | RE:Stack blocks |
what is the second part suppose to do, you code is not the best read, make it easier for us to help you tell us what is the problem exactly and WHY, WHY on earth do you want to make your game into a zip file? |