grindalf, you should try and tab you code, when it comes to functions or loops or if's. So, your code would become:
Looks alot neater, and you can tell the beginning and end of loops, and if's and such. :o)
Graphics 1030,700,16,2 AppTitle "block blaster" HidePointer ;================globals================= Global points Global sztim Global ppx=0 Global ppy=0 Global npower=0 Global x2=550 Global lev=1 Global x=500 Global lives=3 Global y2=640 Global ysp=5 Global sz=100 Global move=0 Global xsp=0 SetBuffer BackBuffer() cr=Rand(50,150) cg=Rand(50,150) cb=Rand(50,150) ClsColor cr,cg,cb ;=======================pills============== SeedRnd MilliSecs() Type pill Field px Field py Field r Field g Field b Field hp Field pillamount=36 End Type For tmpy=150 To 300 Step 30 For tmpx=250 To 750 Step 100 pills.pill=New pill pills\px=tmpx pills\py=tmpy pills\r=Rand(100,200) pills\g=Rand(100,200) pills\b=Rand(100,200) pills\hp=1 Next Next ;======================main loop===================================== While KeyDown(1)=False If move=0 Then x2=x+sz/2 graphicsdraw() controls() If move=1 Then ballmovement() If lives=0 Then End Flip tothp=0 For pills.pill=Each pill If pills\hp=0 Then tothp=tothp+1 Next If tothp=36 Then newlev() Wend End ;=======================keybord controls=========================== Function controls() If KeyDown(203) And x>190 Then x=x-5 If KeyDown(205) And x<900-sz Then x=x+5 If KeyDown(57) Then move=1 End Function ;========================graphics========================== Function graphicsdraw() Cls ; level walls Color 30,30,30 Rect 0,0,190,700 Rect 900,0,130,700 Rect 0,0,1030,50 Color 70,70,70 Rect 20,110,150,500 Rect 903,125,120,225 Color 0,0,0 Line 190,50,190,700 Line 190,50,900,50 Line 900,50,900,700 Rect 20,110,150,500,0 Rect 903,125,120,225,0 ; player bat Color 100,100,100:Rect x,650,sz,30:Color 50,0,0:Rect x,650,20,30:Rect x+sz-20,650,20,30:Color 0,0,0:Rect x,650,sz,30,0 If bat=2 Then Color 0,50,0:Rect x,650,sz,30:Color 0,0,50:Rect x,650,20,30:Rect x+sz-20,650,20,30:Color 0,0,0:Rect x,650,sz,30,0:Color 50,50,50:Rect x+45,640,15,30:Color 0,0,0:Rect x+45,640,15,30,0 ; ball Color 150,150,0:Oval x2,y2,10,10,1:Color 0,0,0:Oval x2,y2,10,10,0 ; pills pills.pill=First pill If pills\hp=1 Then Color pills\r,pills\g,pills\b:Rect pills\px,pills\py,100,30,1:Color 0,0,0:Rect pills\px,pills\py,100,30,0 For tmp=1 To 35 pills=After pills If pills\hp=1 Then Color pills\r,pills\g,pills\b:Rect pills\px,pills\py,100,30,1:Color 0,0,0:Rect pills\px,pills\py,100,30,0 Next ;power pill ppr=Rand(0,255) ppg=Rand(0,255) ppb=Rand(0,255) If npower>0 Then ppy=ppy+1 If npower>0 Then Color ppr,ppg,ppb:Rect ppx,ppy,60,30:Color 0,0,0:Rect ppx,ppy,60,30,0:Text ppx+10,ppy+5,"power" If npower>0 And ppy>700 Then npower=0 If npower>0 And ppy+30>650 And ppy<y+680 And ppx<x+sz And ppx+60>x Then sz=150:sztim=1000:npower=0 sztim=sztim-1 If sztim<0 Then sz=100 ; text lines Color 0,0,0 Text 60,130,"pills "+points Text 60,295,"level "+lev Text 60,430,"lives"+lives Text 930,130,"CONTROLS" Text 905,170,"left and right" Text 905,190,"to move bat." Text 905,330,"Esc to exit" Delay 1 End Function ;=======================ball movement and colisions================================ Function ballmovement() y2=y2+ysp x2=x2+xsp If xsp>5 Then xsp=5 If xsp<-5 Then xsp=-5 Select True Case y2>650 And y2<680 And x2+10>x And x2<x+sz/2+1 ysp=-5 xsp=xsp-1 Case y2>650 And y2<680 And x2>x+sz/2 And x2<x+sz ysp=-5 xsp=xsp+1 Case y2>700 lives=lives-1 x2=x+sz/2 y2=640 xsp=0 move=0 Case y2<50 ysp=5 Case x2>900 xsp=xsp-xsp*2 Case x2<190 xsp=xsp-xsp*2 End Select ; ball to pill collision pills.pill=First pill If pills\hp=1 And x2+20>pills\px+2 And x2<pills\px+98 And y2+20>pills\py And y2<pills\py+30 Then ysp=ysp-ysp*2:pills\hp=0:power=Rand(-5,1)pwx=x2:pwy=y2:points=points+1 If pills\hp=1 And x2+10>pills\px And x2<pills\px+10 And y2-10>pills\py And y2<pills\py+30 Then xsp=xsp-xsp*2:pills\hp=0:power=Rand(-5,1)pwx=x2:pwy=y2:points=points+1 If pills\hp=1 And x2<pills\px+100 And x2>pills\px+90 And y2-10>pills\py And y2<pills\py+30 Then xsp=xsp-xsp*2:pills\hp=0:power=Rand(-5,1)pwx=x2:pwy=y2:points=points+1 For tmp=1 To 35 pills=After pills If pills\hp=1 And x2+10>pills\px And x2<pills\px+10 And y2-10>pills\py And y2<pills\py+30 Then xsp=xsp-xsp*2:pills\hp=0:power=Rand(-5,2):pwx=x2:pwy=y2:points=points+1 If pills\hp=1 And x2<pills\px+100 And x2>pills\px+90 And y2-10>pills\py And y2<pills\py+30 Then xsp=xsp-xsp*2:pills\hp=0:power=Rand(-5,2):pwx=x2:pwy=y2:points=points+1 If pills\hp=1 And x2>pills\px+2 And x2<pills\px+98 And y2+20>pills\py And y2<pills\py+30 Then ysp=ysp-ysp*2:pills\hp=0:power=Rand(-5,2):pwx=x2:pwy=y2:points=points+1 Next If npower<1 Then npower=power:ppy=pwy:ppx=pwx End Function ;=========================new level============================== Function newlev() For pills.pill=Each pill pills\hp=1 pills\r=Rand(100,200) pills\g=Rand(100,200) pills\b=Rand(100,200) Next lev=lev+1 cr=Rand(50,150) cg=Rand(50,150) cb=Rand(50,150) ClsColor cr,cg,cb End Function
Looks alot neater, and you can tell the beginning and end of loops, and if's and such. :o)