Großes Problem!!!

Übersicht BlitzBasic Beginners-Corner

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen

 

noobohneplan

BeitragMi, Dez 02, 2009 21:36
Antworten mit Zitat
Benutzer-Profile anzeigen
soweit verständlich, aber ich habe ein problem dies alles in meinen schon bestehenden code einzu bringen:

Code: [AUSKLAPPEN]
Graphics 1280,1024

menue=LoadImage ("Hauptmenue.bmp")
MaskImage menue,255,255,255

kugelfisch5=LoadImage ("kugelfisch5.bmp")
MaskImage kugelfisch5,255,255,255


DrawImage menue,1,1
DrawImage kugelfisch5,900,650

WaitKey()



SetBuffer BackBuffer()

   Global Screenwidth = GraphicsWidth()
   Global Screenheight=GraphicsHeight()
   Global title$="Loading Truhen-Schieben"

For i=0 To 300

   UpdateBar("Vorgang 1",i,300,0,30)
   
Next

   For j=0 To 1000
   
   UpdateBar("Vorgang 2",j,1000,30,100)
   
   Next


Print "Fertig!"
Print "Spiel Startet..."


Function UpdateBar(info$,current#,max#,startpercent#=0.0,endpercent#=100.0,r1%=128,g1%=0,b1%=0,r2%=0,g2%=192,b2%=0,r3%=255,g3%=255,b3%=255)
   
   Local percent#,milepercent#
   
   Local width%=Screenwidth/2
   Local height%=18
   Local midx%=(Screenwidth/2)
   Local midy%=(Screenheight/2)
   Local sx%=midx-(width/2)
   Local sy%=midy-(height/2)
   Local factor#=width*1.0/100
   
   ; program termination always possible
   If KeyHit(1) Then End
   
   ; calc percentages
   percent=(current*100.0)/max
   milepercent=((percent*(endpercent-startpercent))/100.0)+startpercent
   
   ; upper bar border, red bar background, green progress bar (total)
   DrawBar(sx,sy,width,height,r1,g1,b1)
   DrawBar(sx,sy,Int(milepercent*factor),height,r2,g2,b2)
   Color 0,0,0 : Rect sx,sy,width+1,height,0
   
   ; lower bar border, red bar background, green progress bar (current task)
   DrawBar(sx,sy+height+3,width,height,r1,g1,b1)
   DrawBar(sx,sy+height+3,Int(percent*factor),height,r2,g2,b2)
   Color 0,0,0 : Rect sx,sy+height+3,width+1,height,0
   
   Color r3,g3,b3
   
   ; text infos
   Text midx,midy-18,title,1,1
   Text midx,midy-1,Int(milepercent)+"%",1,1
   Text midx,midy+height+2,info,1,1
   
   Flip 0
   
End Function

Function DrawBar(x%,y%,width%,height%,r%,g%,b%)
   
   Local i%,c%
   
   For i=0 To height-1
     
      Color r,g,b
      Line x,y+i,x+width,y+i
     
   Next
   
End Function



Color 249,0,0

   x=599
   y=200
   c=700
   z=450
   r=1
   u=270
   p=450
   i=600
   m=700
   n=300
   v=600
   b=400
   g=300
   h=450

SetBuffer BackBuffer()

   kugelfisch=LoadImage ("kugelfisch.bmp")
   ScaleImage kugelfisch,0.5,0.5;
   MaskImage kugelfisch,17,92,234

   kugelfisch1=LoadImage ("kugelfisch1.bmp")
   ScaleImage kugelfisch1,0.5,0.5;
   MaskImage kugelfisch1,17,92,234

   kugelfisch3=LoadImage ("kugelfisch3.bmp")
   ScaleImage kugelfisch3,0.5,0.5;
   MaskImage kugelfisch3,17,92,234

   kugelfisch2=LoadImage ("kugelfisch2.bmp")
   ScaleImage kugelfisch2,0.5,0.5;
   MaskImage kugelfisch2,17,92,234

   schatztruhe=LoadImage ("schatztruhe.bmp")
   MaskImage schatztruhe,17,92,234

   schatztruhe2=LoadImage ("schatztruhe2.bmp")
   MaskImage schatztruhe2,17,92,234

   schatztruhe3=LoadImage ("schatztruhe3.bmp")
   MaskImage schatztruhe3,17,92,234

   map1=LoadImage ("map1.bmp")
   ScaleImage map1,1.7,1.7;
   MaskImage map1,255,255,255
                                 
   map2=LoadImage ("map2.bmp")
   ScaleImage map2,1.7,1.7;
   MaskImage map2,255,255,255

   map3=LoadImage ("map3.bmp")
   ScaleImage map3,1.7,1.7;
   MaskImage map3,255,255,255

   map4=LoadImage ("map4.bmp")
   ScaleImage map4,1.7,1.7;
   MaskImage map4,255,255,255

   ziel1=LoadImage ("ziel1.bmp")
   MaskImage ziel1,255,255,255

   ziel2=LoadImage ("ziel2.bmp")
   MaskImage ziel2,255,255,255

   ziel3=LoadImage ("ziel3.bmp")
   MaskImage ziel3,255,255,255

   hintergrund1=LoadImage ("hintergrund1.bmp")
   MaskImage hintergrund1,255,255,255

   hintergrund4=LoadImage ("hintergrund4.bmp")
   MaskImage hintergrund4,255,255,255

   hintergrund3=LoadImage ("hintergrund3.bmp")
   MaskImage hintergrund3,255,255,255

   hintergrund2=LoadImage ("hintergrund2.bmp")
   MaskImage hintergrund2,255,255,255

   blasen=LoadImage ("blasen.bmp")
   MaskImage blasen,17,92,234

   menue=LoadImage ("Hauptmenue.bmp")
   MaskImage menue,255,255,255

   rand1=LoadImage ("rand1.bmp")
   MaskImage rand1,255,255,255

   rand2=LoadImage ("rand2.bmp")
   MaskImage rand2,255,255,255

   rand3=LoadImage ("rand3.bmp")
   MaskImage rand3,255,255,255

Cls


blubb=PlayMusic("1.mp3")

ClsColor 17,92,234 Cls



While Not KeyHit(1)


   If KeyDown(205) ; (links)
   r=1
   x=x+10
   vonwo$ = "rechts"
   EndIf

   If KeyDown(203) ; (rechts)
   r=2
   x=x-10
   vonwo$ = "links"
   EndIf

   If KeyDown(208) ; (hoch)
   r=3
   y=y+10
   vonwo$ = "runter"
   EndIf

   If KeyDown(200) ; (runter)
   r=4
   y=y-10
   vonwo$ = "hoch"
   EndIf
 
Cls

If ImagesCollide (kugelfisch,x,y,0,schatztruhe,c,z,0) And vonwo$ = "runter"
   z=z+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe,c,z,0) And vonwo$ = "links"
   c=c-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe,c,z,0) And vonwo$ = "rechts"
   c=c+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe,c,z,0) And vonwo$ = "hoch"
   z=z-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe2,g,h,0) And vonwo$ = "runter"
   h=h+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe2,g,h,0) And vonwo$ = "links"
   g=g-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe2,g,h,0) And vonwo$ = "rechts"
   g=g+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe2,g,h,0) And vonwo$ = "hoch"
   h=h-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe,v,b,0) And vonwo$ = "runter"
   b=b+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe3,v,b,0) And vonwo$ = "links"
   v=v-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe3,v,b,0) And vonwo$ = "rechts"
   v=v+10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$
If ImagesCollide (kugelfisch,x,y,0,schatztruhe3,v,b,0) And vonwo$ = "hoch"
   b=b-10
   Text 0,0, "hallo"
   EndIf
   Text 0,0, vonwo$



If ImagesCollide (schatztruhe,c,z,0,ziel1,u,800,0)
   c=c-10
   z=z-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,ziel2,p,i,0)
   g=g-10
   h=h-10
   EndIf
If ImagesCollide (schatztruhe3,c,z,0,ziel3,m,n,0)
   c=c-10
   z=z-10
   EndIf



If ImagesCollide (kugelfisch,x,y,0,map1,200,100,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,map2,216,861,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,map3,216,100,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,map4,993,100,0) And vonwo$ = "rechts"
   x=x-10
   EndIf

   
   
If ImagesCollide (schatztruhe,c,z,0,map1,200,100,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,map2,216,861,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,map3,216,100,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,map4,993,100,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,map1,200,100,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,map2,216,861,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,map3,216,100,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,map4,993,100,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map1,200,100,0) And vonwo$ = "links"
   v=v+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map2,216,861,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map3,216,100,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map4,993,100,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map2,216,861,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map3,216,100,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,map4,993,100,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
   
   
   
If ImagesCollide (kugelfisch,x,y,0,rand1,760,509,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand1,760,509,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand1,760,509,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand1,760,509,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand1,760,509,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand1,760,509,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand1,760,509,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand1,760,509,0) And vonwo$ = "links"
   x=x+10
   EndIf   
If ImagesCollide (kugelfisch3,x,y,0,rand1,760,509,0) And vonwo$ = "hoch"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand1,760,509,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand1,760,509,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand1,760,509,0) And vonwo$ = "links"
   x=x+10
   EndIf   
If ImagesCollide (kugelfisch1,x,y,0,rand1,760,509,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand1,760,509,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand1,760,509,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand1,760,509,0) And vonwo$ = "links"
   x=x+10
   EndIf   
If ImagesCollide (kugelfisch,x,y,0,rand2,215,250,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand2,215,250,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand2,215,250,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand2,215,250,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand2,215,250,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand2,215,250,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand2,215,250,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand2,215,250,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand2,215,250,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand2,215,250,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand2,215,250,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand2,215,250,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand2,215,250,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand2,215,250,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand2,215,250,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand2,215,250,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand3,350,743,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand3,350,743,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand3,350,743,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch,x,y,0,rand3,350,743,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand3,350,743,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand3,350,743,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand3,350,743,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch1,x,y,0,rand3,350,743,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand3,350,743,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand3,350,743,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand3,350,743,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch2,x,y,0,rand3,350,743,0) And vonwo$ = "links"
   x=x+10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand3,350,743,0) And vonwo$ = "rechts"
   x=x-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand3,350,743,0) And vonwo$ = "hoch"
   y=y+10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand3,350,743,0) And vonwo$ = "runter"
   y=y-10
   EndIf
If ImagesCollide (kugelfisch3,x,y,0,rand3,350,743,0) And vonwo$ = "links"
   x=x+10
   EndIf



If ImagesCollide (schatztruhe,c,z,0,rand1,760,509,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand1,760,509,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand1,760,509,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand1,760,509,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand2,215,250,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand2,215,250,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand2,215,250,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand2,215,250,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand3,350,743,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand3,350,743,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand3,350,743,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,rand3,350,743,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand1,760,509,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand1,760,509,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand1,760,509,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand1,760,509,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand2,215,250,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand2,215,250,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand2,215,250,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand2,215,250,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand3,350,743,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand3,350,743,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand3,350,743,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,rand3,350,743,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand1,760,509,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand1,760,509,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand1,760,509,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand1,760,509,0) And vonwo$ = "links"
   v=v+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand2,215,250,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand2,215,250,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand2,215,250,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand2,215,250,0) And vonwo$ = "links"
   v=v+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand3,350,743,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand3,350,743,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand3,350,743,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,rand3,350,743,0) And vonwo$ = "links"
   v=v+10
   EndIf


If ImagesCollide (schatztruhe,c,z,0,schatztruhe2,g,h,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe2,g,h,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe2,g,h,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe2,g,h,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe,c,z,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe,c,z,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe,c,z,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe,c,z,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe,c,z,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe,c,z,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe,c,z,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe,c,z,0) And vonwo$ = "links"
   v=v+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe3,v,b,0) And vonwo$ = "rechts"
   c=c-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe3,v,b,0) And vonwo$ = "hoch"
   z=z+10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe3,v,b,0) And vonwo$ = "runter"
   z=z-10
   EndIf
If ImagesCollide (schatztruhe,c,z,0,schatztruhe3,v,b,0) And vonwo$ = "links"
   c=c+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe3,v,b,0) And vonwo$ = "rechts"
   g=g-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe3,v,b,0) And vonwo$ = "hoch"
   h=h+10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe3,v,b,0) And vonwo$ = "runter"
   h=h-10
   EndIf
If ImagesCollide (schatztruhe2,g,h,0,schatztruhe3,v,b,0) And vonwo$ = "links"
   g=g+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe2,g,h,0) And vonwo$ = "rechts"
   v=v-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe2,g,h,0) And vonwo$ = "hoch"
   b=b+10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe2,g,h,0) And vonwo$ = "runter"
   b=b-10
   EndIf
If ImagesCollide (schatztruhe3,v,b,0,schatztruhe2,g,h,0) And vonwo$ = "links"
   v=v+10
   EndIf





   If r=3 DrawImage kugelfisch2,x,y
   If r=4 DrawImage kugelfisch3,x,y
   If r=1 DrawImage kugelfisch,x,y
   If r=2 DrawImage kugelfisch1,x,y

   DrawImage schatztruhe,c,z
   DrawImage schatztruhe2,g,h
   DrawImage schatztruhe3,v,b
   DrawImage map1,200,100
   DrawImage map2,216,861
   DrawImage map3,216,100
   DrawImage map4,993,100
   DrawImage ziel1,u,150
   DrawImage ziel2,p,i
   DrawImage ziel3,m,n
   DrawImage hintergrund1,-205,0
   DrawImage hintergrund2,200,877
   DrawImage hintergrund3,50,-305
   DrawImage hintergrund4,1009,50
   DrawImage blasen,380,200
   DrawImage blasen,545,680
   DrawImage rand1,760,509
   DrawImage rand2,215,250
   DrawImage rand3,350,743


Flip
Wend


könntest du mir da auch weiterhelfen? Smile

Starwar

BeitragMi, Dez 02, 2009 21:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich habe dir da was komplettes geschrieben.
Ich vertraue ihn dir an in der Hoffnung du kopierst ihn nicht nur, sondern du versuchst ihn zu verstehen. Und wenn du's nicht tust, frage. Sehr wichtig Wink
Ich bin nicht so gut im Kommentieren Very Happy

EDIT: Fang am Besten ganz neu an, dann bekommst du eine vernünftige Struktur hin.
MFG

Code: [AUSKLAPPEN]
AppTitle "Test"
Graphics 800,600,32,2
SetBuffer BackBuffer()

SeedRnd MilliSecs() ;"Zufall"

Dim map(12,8) ;Karte
zufallskarte() ;Eine Map erstellen
spielerX=0
spielerY=0

timer=CreateTimer(30) ;30FPS
Repeat
   netzZeichen() ;Ein unschönes Netz
   drawMap() ;Schätze und Blöcke zeichnen
   
   ;[Block] Bewegungen
   If KeyHit(203) Then ;Links
      If spielerX > 0 Then ;Damit er nicht aus dem Spiel austritt
         If map(spielerX-1,spielerY) <> 1 Then ;Kein Block auf dem Zielfeld
            spielerX = spielerX-1 ; Bewegen
         EndIf
      EndIf
      schatzAnz = getSchatz(spielerX,spielerY,schatzAnz) ; Schatz einsammeln
   EndIf
   
   If KeyHit(205) Then ;Rechts
      If spielerX < 11 Then ;Damit er nicht aus dem Spiel austritt
         If map(spielerX+1,spielerY) <> 1 Then ;Kein Block auf dem Zielfeld
            spielerX = spielerX+1 ; Bewegen
         EndIf
      EndIf
      schatzAnz = getSchatz(spielerX,spielerY,schatzAnz) ; Schatz einsammeln
   EndIf
   
   If KeyHit(208) Then ;Unten
      If spielerY < 7 Then ;Damit er nicht aus dem Spiel austritt
         If map(spielerX,spielerY+1) <> 1 Then ;Kein Block auf dem Zielfeld
            spielerY = spielerY+1 ; Bewegen
         EndIf
      EndIf
      schatzAnz = getSchatz(spielerX,spielerY,schatzAnz) ; Schatz einsammeln
   EndIf
   
   If KeyHit(200) Then ;Oben
      If spielerY > 0 Then ;Damit er nicht aus dem Spiel austritt
         If map(spielerX,spielerY-1) <> 1 Then ;Kein Block auf dem Zielfeld
            spielerY = spielerY-1 ; Bewegen
         EndIf
      EndIf
      schatzAnz = getSchatz(spielerX,spielerY,schatzAnz) ; Schatz einsammeln
   EndIf
   ;[End Block]
   
   Color 255,0,0
   Oval 11+40*spielerX,11+40*spielerY,38,38 ;Des Spieler zeichen
   Color 255,255,255
   Text 5,500,schatzanz + " Schätze gesammelt"
   
   Flip 0 ;V-Sync aus
   waittimer timer
   Cls
Until KeyDown(1)
End

Function getSchatz%(x,y,schatzanz)
   If map(x,y) = 2 Then ;Wenn auf dem Feld ein Schatz liegt
      map(x,y)=0 ;Schatz löschen
      schatzanz=schatzanz+1 ;Anzahl gesammelter Schätze erhöhen
   EndIf
   Return schatzanz
End Function

Function drawMap()
   For x=0 To 11
      For y=0 To 7
         Select map(x,y)
            Case 1 ;Block zeichen
               Color 200,200,200
               Rect 11+40*x,11+40*y,38,38
            Case 2 ;Schatz zeichnen
               Color 0,255,0
               Rect 11+40*x,11+40*y,38,38
         End Select
      Next
   Next
End Function

Function netzZeichen()
   Color 255,255,255
   For x=0 To 11
      For y=0 To 7
         Rect 10+40*x,10+40*y,40,40,0
      Next
   Next
End Function

Function zufallskarte()
   For x=0 To 11
      For y=0 To 7
         zufall = Rand(0,10)
         If zufall = 0 Then
            map(x,y)=1 ;Block setzen
         ElseIf zufall = 1 Then
            map(x,y)=2 ;Schatz setzen
         EndIf
      Next
   Next
   map(0,0)=0 ;Starposition des Spielers frei machen.
End Function

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group