Falling sand Game

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

 

FWeinb

ehemals "ich"

Betreff: Falling sand Game

BeitragDi, Jan 23, 2007 16:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Es gab hier im Forum mal im codearciv so ein falling sand Game nun habe ich versucht das weiter zumachen nur ist mein Problem das ich nicht weiß wie ich es machen kann das wenn ich Glas mache also es mit feuer geschmolzen habe wie ich das wieder erstarren lassen kann

hier der Code

Code: [AUSKLAPPEN]

Graphics 640,480,16,2
SetBuffer BackBuffer()


Type blackhole
   Field x,y
   Field size,dir
   Field donotabsorb
End Type

Const sizex = 639
Const sizey = 300

Global ri

;image = CreateImage(sizex,sizey)
bank = CreateBank(sizex*sizey+1)

;b.blackhole = New blackhole
;b\x         = 200
;b\y         = 140
;b\size      = 200
;b\donotabsorb = 3

Global CountSalz=0
Global CountWasser=0
Global CountOil=0

Global tool$="Stein"
Global auswahl

Repeat
   Cls
   
   modul

   t=t+1
   
   CountSalz=CountSalz+KeyHit(22)-KeyHit(36)
   If CountSalz<0 Then CountSalz=CountSalz+6
   CountSalz=CountSalz Mod 6
   
   CountWasser=CountWasser+KeyHit(24)-KeyHit(38)
   If CountWasser<0 Then CountWasser=CountWasser+6
   CountWasser=CountWasser Mod 6
   
   CountOil=CountOil+KeyHit(23)-KeyHit(37)
   If CountOil<0 Then CountOil=CountOil+6
   CountOil=CountOil Mod 6
   
      If Not KeyDown(57)
      For c=1 To CountSalz
         PokeByte bank,(sizex/4+Rand(-20,20))*sizey+sizey-1,1
      Next
      For c=1 To CountWasser
         PokeByte bank,(sizex*3/4+Rand(-20,20))*sizey+sizey-1,2
      Next
      For c=1 To CountOil
         PokeByte bank,(sizex*2/4+Rand(-20,20))*sizey+sizey-1,4
      Next
   EndIf
   
   If MouseDown(1) And tool$="Stein" ; Wand erstellen
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,3
         Next
      Next
   ElseIf MouseDown(2) ; Löschen
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,0
         Next
      Next
   ElseIf KeyDown(2) ; Feuer!!
      For x = MouseX()-1 To MouseX()+1
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,5
         Next
      Next
   ElseIf MouseDown(1) And tool$="Gras" ; Grün
      For x = MouseX()-1 To MouseX()+1
         For y = MouseY()-1 To MouseY()+1
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,6
         Next
      Next
   ElseIf MouseDown(1) And tool$="Wolke" ; wolke
      For x = MouseX()-2 To MouseX()+2
         For y = MouseY()-2 To MouseY()+2
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,7
         Next
      Next
   ElseIf MouseDown(1) And tool$="Säure" ; säure
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,10
         Next
      Next
   ElseIf MouseDown(1) And tool$="Heizer" ; herd
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,11
         Next
      Next
   ElseIf MouseDown(1) And tool$="Kühler" ; kühler
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,12
         Next
      Next
    ElseIf MouseDown(1) And tool$="Glas" ; kühler
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,13
         Next
      Next
   EndIf
   
   UpdateSand(bank)
   
   UpdateBlackHoles(bank)
   
   fps# = (fps*19+1000/(MilliSecs()-ms))/20
   ms = MilliSecs()
   Color 255,255,255
   Text 500,0,fps
   Flip 0
Until KeyHit(1)
End

Function UpdateBlackHoles(bank)
   For b.blackhole = Each blackhole
      For i2 = 0 To 60
         le = Rand(b\size/2,b\size)
         dir# = Rnd(360)
         s# = Sin(dir)
         c# = Cos(dir)
         x2 = b\x
         y2 = b\y
         For i = 1 To le
            x = b\x + c*i
            y = b\y + s*i
            x2 = b\x + c*(i+1)
            y2 = b\y + s*(i+1)
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then
               If x2 > 2 And y2 > 2 And x2 < sizex-3 And y2 < sizey-3 Then
                  t2 = PeekByte(bank,x2*sizey-y2)
               Else
                  t2 = 0
               EndIf
               If b\donotabsorb=0 Then
                  PokeByte bank,x*sizey-y,t2
               Else
                  If t2 = b\donotabsorb Then
                     t2=0
                  Else
                     t2 = PeekByte(bank,x2*sizey-y2)
                  EndIf
                  If PeekByte(bank,x*sizey-y) <> b\donotabsorb
                     PokeByte bank,x*sizey-y,t2
                  EndIf
               EndIf
            EndIf
            x2 = x
            y2 = y
         Next
         ;line b\x,b\y,b\x+c*le,b\y+s*le
         Color 200,0,200
         Rect b\x-2,b\y-2,4,4
      Next
   Next
End Function

Function UpdateSand(bank)
   LockBuffer BackBuffer()
   
   For i = 1 To 1
      ri = 1-ri
      x = (sizex-1)*(ri=1)
      Ende = (sizex-1)*(ri=0)
      While (x < ende And ri = 0) Or (x > ende And ri = 1)
         If ri = 1 Then x = x - 1 Else x = x + 1
         typo = 1
         For y = 0 To sizey-1
            off = x*sizey+y
            typ = PeekByte(bank,off)
            showtyp = typ
            showtyp2 = PeekByte(bank,off+1)
           
           
           
            Select typ
            Case 1,2,4,10,14 ; salz, wasser, öl, säure
               moved = 0
               If typ = 10 And Rand(5)=5; ätzen
                  ; lösen!
                  If False ; rem
                     Select Rand(0,1)
                     Case 0
                        If x > 1 And x < sizex-2
                           typ2 = PeekByte(bank,off-sizey)
                           typ3 = PeekByte(bank,off+sizey)
                           If typ2 <> 2 And typ3 = 2 Then
                              PokeByte bank,off+sizey,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 2 And typ3 <> 2 Then
                              PokeByte bank,off-sizey,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 2 And typ3 <> 2 And Rand(1) And x > 2 And x < sizex-3
                              typ2 = PeekByte(bank,off-sizey*2)
                              typ3 = PeekByte(bank,off+sizey*2)
                              If typ2 <> 2 And typ3 = 2 Then
                                 PokeByte bank,off+sizey*2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 2 And typ3 <> 2 Then
                                 If Rand(1) Then PokeByte bank,off-sizey*2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     Case 1
                        If y > 1 And y < sizey-2
                           typ2 = PeekByte(bank,off-1)
                           typ3 = PeekByte(bank,off+1)
                           If typ2 <> 2 And typ3 = 2 Then
                              PokeByte bank,off+1,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 2 And typ3 <> 2 Then
                              PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 2 And typ3 <> 2 And Rand(1) And y > 2 And y < sizey-3
                              typ2 = PeekByte(bank,off-2)
                              typ3 = PeekByte(bank,off+2)
                              If typ2 <> 2 And typ3 = 2 Then
                                 PokeByte bank,off+2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 2 And typ3 <> 2 Then
                                 If Rand(1) Then PokeByte bank,off-2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     End Select ; endrem
                  Else
                     r = Rand(1,10)
                     Select r
                     Case 1
                        If x > 0 And y < sizey-1
                           typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 2
                        If y < sizey-1
                           typ2 = PeekByte(bank,off+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,off+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 3
                        If x < sizex-1 And y < sizey
                           typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 4
                        If x > 0
                           typ2 = PeekByte(bank,x*sizey-sizey+y)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 5
                        If x < sizex-1
                           typ2 = PeekByte(bank,x*sizey+sizey+y)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 6
                        If x > 0 And y >0
                           typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 7
                        If y > 0
                           typ2 = PeekByte(bank,off-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 8
                        If x < sizex-1 And y > 0
                           typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     End Select
                  EndIf
               EndIf
               If typo = 0 Or typo = 8 Or typo=9 Or (typ=1 And (typo=2 Or typo=4)) Or (typ=2 And typo=4) Then
                  If typo = 0 Or Rand(0,1)
                     PokeByte bank,off,typo
                     PokeByte bank,off-1,typ
                     typ = typo
                  EndIf
               ElseIf y > 0
                  If typ = 2 Or typ = 4
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                     
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2) Or ((typ3=8 Or typ3=9) And Rand(0,2)=1))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2) Or ((typ2=8 Or typ2=9) And Rand(0,2)=1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                  EndIf
                  If typ = 2 Or typ = 4 Or typ = 10
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                 
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                     
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                 
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                  EndIf
                 
               
                  If Rand(1,2) = 1 And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y-1,typ
                        typ = typ2
                        moved = 1
                     ElseIf Rand(0,1) And x < sizex-3
                        typ2 = PeekByte(bank,x*sizey+sizey*2+y-1)
                        If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey+sizey*2+y-1,typ
                           typ = typ2
                           moved = 1
                        EndIf
                     EndIf
                  ElseIf x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey-sizey+y-1,typ
                        typ = typ2
                        moved = 1
                     ElseIf Rand(0,1) And x > 2
                        typ2 = PeekByte(bank,x*sizey-sizey*2+y-1)
                        If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey-sizey*2+y-1,typ
                           typ = typ2
                           moved = 1
                        EndIf
                     EndIf
                  EndIf
               EndIf
            Case 5 ; feuer
               If Rand(50)=1
                  PokeByte bank,off,8
                  If PeekByte(bank,off+1) = 2 Then PokeByte bank,off,9
                  typ = 8
               ElseIf Rand(0,1) And y < sizey-2
                  typ2 = PeekByte(bank,off+1)
                  Select typ2
                  Case 0
                     If Rand(2)=2
                        PokeByte bank,off,typ2
                        PokeByte bank,off+1,typ
                        typ = typ2
                     EndIf
                  Case 1,11
                     If Rand(10)=2
                        PokeByte bank,off,0
                        typ = 0
                     EndIf
                  Case 2,12
                     PokeByte bank,off,9
                     typ = 9
                  Case 4,6
                     If Rand(0,1)
                        PokeByte bank,off+1,typ
                        typ = typ
                     EndIf
                  Case 13;Glas (schmelzen)
                      PokeByte bank,off+1,14
                        typ = 14
                  End Select

               ElseIf Rand(0,1) And y > 1
                  If Rand(0,1) And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     Select typ2
                     Case 0
                        If Rand(20)=2
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey+sizey+y-1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2)=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey+sizey+y-1,typ
                           typ = typ
                        EndIf
                     End Select
                  ElseIf x > 1 And Rand(0,1)
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     Select typ2
                     Case 0
                        If Rand(20=2)
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey-sizey+y-1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2)=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey-sizey+y-1,typ
                           typ = typ
                        EndIf
                     End Select
                  Else
                     typ2 = PeekByte(bank,off+1)
                     Select typ2
                     Case 0
                        If Rand(10)=5
                           PokeByte bank,off,typ2
                           PokeByte bank,off+1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        PokeByte bank,off,0
                        typ = 0
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,off+1,typ
                           typ = typ
                        EndIf
                     End Select
                  EndIf
               Else
                  If Rand(0,1) And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     Select typ2
                     Case 0
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2-(typ2=12))=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey+sizey+y,typ
                           typ = typ
                        EndIf
                     End Select
                  ElseIf x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     Select typ2
                     Case 0
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ2
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2-(typ2=12))=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey-sizey+y,typ
                           typ = typ
                        EndIf
                     End Select
                  EndIf
               EndIf
            Case 6 ; pflanze
               r = Rand(1,40)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y+1,0
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 2
                        PokeByte bank,off+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+y-1,0
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y+1,0
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y,0
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y,0
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y-1,0
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 2
                        PokeByte bank,off-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+y-1,0
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y-1,0
                     EndIf
                  EndIf
               Case 38
                  If Rand(20)=1 Then   PokeByte bank,off,4
               End Select
            Case 7 ; wolke
               If Rand(0,30)=4 And y > 1
                  typ2 = PeekByte(bank,off-1)
                  If typ2 = 0
                     PokeByte bank,off-1,2
                  EndIf
               EndIf
            Case 8,9,14 ; wasser/co2-gas
               moved = 0
               typo = PeekByte(bank,off+1)
               If Rand(300)=1 And typ = 9 Or typ=14 Then
                  typ = 2
                  PokeByte bank,off,typ
               Else
                  If y < sizey-1 And Rand(0,6)=2 And typo = 0 ;<> 3 And typo <> 6 And typo <> 7 And typo <> 11 And typo<>12
                     PokeByte bank,off,typo
                     If y < sizey-2 Then PokeByte bank,off+1,typ
                     typ = typo
                  Else ; expandieren
                     Select Rand(0,1)
                     Case 0
                        If x > 1 And x < sizex-2
                           typ2 = PeekByte(bank,off-sizey)
                           typ3 = PeekByte(bank,off+sizey)
                           If typ2 <> 0 And typ3 = 0 Then
                              PokeByte bank,off+sizey,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 0 And typ3 <> 0 Then
                              PokeByte bank,off-sizey,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 = 0 And typ3 = 0 And Rand(0,1) And y < sizey-1
                              typ2 = PeekByte(bank,off+1)
                              If typ2 Then
                                 Select Rand(0,1)
                                 Case 0
                                    PokeByte bank,off-sizey,typ
                                    PokeByte bank,off,0
                                    typ = 0
                                 Case 1
                                    PokeByte bank,off+sizey,typ
                                    PokeByte bank,off,0
                                    typ = 0
                                 End Select
                              ElseIf y < sizey-2
                                 typ2 = PeekByte(bank,off+2)
                                 If typ2 Then
                                    Select Rand(0,1)
                                    Case 0
                                       PokeByte bank,off-sizey,typ
                                       PokeByte bank,off,0
                                       typ = 0
                                    Case 1
                                       PokeByte bank,off+sizey,typ
                                       PokeByte bank,off,0
                                       typ = 0
                                    End Select
                                 EndIf
                              EndIf
                           ElseIf typ2 <> 0 And typ3 <> 0 And x > 2 And x < sizex-3 And False
                              typ2 = PeekByte(bank,off-sizey*2)
                              typ3 = PeekByte(bank,off+sizey*2)
                              If typ2 <> 0 And typ3 = 0 Then
                                 PokeByte bank,off+sizey*2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 0 And typ3 <> 0 Then
                                 PokeByte bank,off-sizey*2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     Case 1
                        If y > 1 And y < sizey-2
                           typ2 = PeekByte(bank,off-1)
                           typ3 = PeekByte(bank,off+1)
                           If typ2 <> 0 And typ3 = 0 Then
                              PokeByte bank,off+1,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 0 And typ3 <> 0 Then
                              PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ3 <> 0 And Rand(1) And y > 2 And y < sizey-3 And False
                              typ2 = PeekByte(bank,off-2)
                              typ3 = PeekByte(bank,off+2)
                              If typ2 <> 0 And typ3 = 0 Then
                                 PokeByte bank,off+2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 0 And typ3 <> 0 Then
                                 PokeByte bank,off-2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     End Select
                  EndIf
               EndIf
            Case 11 ; herd
               r = Rand(1,10)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y+1,9
                     ElseIf typ2 > 1 And typ2 < 8  And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y+1,5
                     ElseIf typ2 = 13
                    PokeByte bank,x*sizey+sizey+y+1,0
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 2
                        PokeByte bank,off+1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,off+1,5
                      ElseIf typ2 = 13
                         PokeByte bank,off+1,0
                        PokeByte bank,off+1,14
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y+1,9
                     ElseIf typ2 > 1 And typ2 < 8 And  typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y+1,5
                     ElseIf typ2 = 13
                        PokeByte bank,x*sizey+sizey+y+1,0
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y,5
                       ElseIf typ2 = 13
                        PokeByte bank,x*sizey+sizey+y+1,0
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y,9
                     ElseIf typ2 > 1 And typ2 < 8 And  typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y,5
                      ElseIf typ2 = 13
                        PokeByte bank,x*sizey+sizey+y+1,0
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y-1,5
                     ElseIf typ2 = 13
                        PokeByte bank,x*sizey+sizey+y+1,0
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 2
                        PokeByte bank,off-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,off-1,5
                      ElseIf typ2 = 13
                         PokeByte bank,off+1,0
                        PokeByte bank,off+1,14
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y-1,5
                      ElseIf typ2 = 13
                        PokeByte bank,x*sizey+sizey+y+1,14
                     EndIf
                  EndIf
               End Select
            Case 12 ; kühler
               r = Rand(1,10)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y+1,2
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 9
                        PokeByte bank,off+1,2
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y+1,2
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y,2
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y,2
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y-1,2
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 9
                        PokeByte bank,off-1,2
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y-1,2
                     EndIf
                  EndIf
               End Select
               
            End Select
           
           
            ;If iterations = i
            If showtyp2 <> showtyp ; hell
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $ffffff
               Case 2 ; wasser
                  col = $3065ff
               Case 3 ; stein
                  col = $c8c8c8
               Case 4 ; öl
                  col = $daa953
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $40ec61
               Case 7 ; wolke
                  col = $60c0ff
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $ff7498
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; Glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               End Select
               If col WritePixelFast x,sizey-y,col
            ElseIf typo2 <> showtyp ; dunkel
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $bbbbbb
               Case 2 ; wasser
                  col = $0000bb
               Case 3 ; stein
                  col = $555555
               Case 4 ; öl
                  col = $774400
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $009900
               Case 7 ; wolke
                  col = $1188aa
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $aa0000
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               End Select
               If col WritePixelFast x,sizey-y,col
            Else
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $ccccaa
               Case 2 ; wasser
                  col = $0000ff
               Case 3 ; stein
                  col = $888888
               Case 4 ; öl
                  col = $aa9933
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $00cc11
               Case 7 ; wolke
                  col = $40a0ff
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $ff0033
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; Glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               End Select
               If col WritePixelFast x,sizey-y,col
            EndIf
            typo2 = showtyp
            typo = typ
         Next
      Wend
   Next
   
   UnlockBuffer BackBuffer()
End Function


Function modul()

If auswahl=1 Then

If MouseHit(1) And MouseX()>98 And MouseX()<111 Then
      If MouseY()>330 And MouseY()<343 Then tool$="Stein":auswahl=0
      If MouseY()>350 And MouseY()<363 Then tool$="Gras":auswahl=0
      If MouseY()>370 And MouseY()<383 Then tool$="Wolke":auswahl=0
      If MouseY()>390 And MouseY()<403 Then tool$="Säure":auswahl=0
      If MouseY()>410 And MouseY()<423 Then tool$="Heizer":auswahl=0
      If MouseY()>430 And MouseY()<443 Then tool$="Kühler":auswahl=0
      If MouseY()>450 And MouseY()<463 Then tool$="Glas":auswahl=0
   EndIf

   Color 0,0,$888888
   Rect 98,330,13,13
   Color 0,0,$00cc11
   Rect 98,350,13,13
   Color 0,0,$40a0ff
   Rect 98,370,13,13
   Color 0,0,$ff0033
   Rect 98,390,13,13
   Color 0,0,$ed8640
   Rect 98,410,13,13
   Color 0,0,$88ddff
   Rect 98,430,13,13
   Color 0,0,$000099
   Rect 98,450,13,13

   Color 255,255,255
   Text 120,330,"Stein"
   Text 120,350,"Gras"
   Text 120,370,"Wolke"
   Text 120,390,"Säure"
   Text 120,410,"Heizer"
   Text 120,430,"Kühler"
   Text 120,450,"Glas"

   Text 10,330,"Auswählen:"

EndIf

If auswahl=0 Then
   If MouseHit(1) And MouseX()>98 And MouseX()<111 And MouseY()>330 And MouseY()<343 Then auswahl=1-auswahl   
   Text 50,330,"Tool:   "+tool$
   Select tool$
      Case "Stein"
         Color 0,0,$888888
      Case "Gras"
         Color 0,0,$00cc11
      Case "Wolke"
         Color 0,0,$40a0ff
      Case "Säure"
         Color 0,0,$ff0033
      Case "Heizer"
         Color 0,0,$ed8640
      Case "Kühler"
         Color 0,0,$88ddff
      Case "Glas"
         Color 0,0,$000099
   End Select
     
   Rect 98,330,13,13
   Color 255,255,255
EndIf


End Function
"Wenn die Menschen nur über das sprächen, was sie begreifen, dann würde es sehr still auf der Welt sein." Albert Einstein (1879-1955)
"If you live each day as if it was your last, someday you'll most certainly be right." Steve Jobs
 

Dreamora

BeitragDi, Jan 23, 2007 16:13
Antworten mit Zitat
Benutzer-Profile anzeigen
Was hattest du denn bisher für Ideen um das umzusetzen? Sprich wo ist bei der Implementation deiner Idee genau das Problem?

~VERSCHOBEN~

falsches Board
Dreamora
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen.
 

FWeinb

ehemals "ich"

BeitragDi, Jan 23, 2007 16:19
Antworten mit Zitat
Benutzer-Profile anzeigen
Mein problem liegt darin das ich nicht weiß wie ich wenn ich jetzt das objekt glas in Glas Flüssieg umgewandelt habe nach einer gewissen zeit es auch wieder in Glas umzuwandeln wenn es nicht grade auf einem Heier liegt


Danke im Vorraus
"Wenn die Menschen nur über das sprächen, was sie begreifen, dann würde es sehr still auf der Welt sein." Albert Einstein (1879-1955)
"If you live each day as if it was your last, someday you'll most certainly be right." Steve Jobs
 

Dreamora

BeitragDi, Jan 23, 2007 16:36
Antworten mit Zitat
Benutzer-Profile anzeigen
Müsstest du dir sowas wie eine Temparatur oder "Zeit seit Flüssig werden" merken für die entsprechenden Teile, wie es in der Realität auch ist. Sprich es "abkühlen" lassen.
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen.
 

FWeinb

ehemals "ich"

BeitragDi, Jan 23, 2007 19:38
Antworten mit Zitat
Benutzer-Profile anzeigen
Soll ich das für jedes eizenel Pixel machen das ist doch ein bischen viel denke ich
"Wenn die Menschen nur über das sprächen, was sie begreifen, dann würde es sehr still auf der Welt sein." Albert Einstein (1879-1955)
"If you live each day as if it was your last, someday you'll most certainly be right." Steve Jobs

Tankbuster

BeitragDi, Jan 23, 2007 19:42
Antworten mit Zitat
Benutzer-Profile anzeigen
Ohhh man! denkst du ich lese das GANZE durch?^^
Wenn du jedes Pixel einzeln malst sinken die FPS in den Keller! (nicht von mir der Spruch)
Aber ich hab auch keine andere Idee muss ich zugeben Rolling Eyes
Twitter
Download Jewel Snake!
Windows|Android
 

FWeinb

ehemals "ich"

BeitragDi, Jan 23, 2007 20:41
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich male jeden Pixel einzelnt ??? so habe ich dne code zuminstst verstanden also die werte werden in ein Bank gespeichert und dann wieder ausgelesen
"Wenn die Menschen nur über das sprächen, was sie begreifen, dann würde es sehr still auf der Welt sein." Albert Einstein (1879-1955)
"If you live each day as if it was your last, someday you'll most certainly be right." Steve Jobs
 

Dreamora

BeitragDi, Jan 23, 2007 20:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Und wo ist dann das Problem im gleichen durchlauf in einer zweiten bank die "temparatur" oder was auch immer für jeden pixel zu speichern? (oder sogar direkt auf einem zweiten image / textur)
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen.
 

FWeinb

ehemals "ich"

BeitragDi, Jan 23, 2007 20:57
Antworten mit Zitat
Benutzer-Profile anzeigen
stimmt daran habe ich garnicht gedacht danke ich habe das aber jetzt so gemacht das wenn es auf stein triffet kalt wir


[Edit]

Danke habe es hinbekommen danke danke danke an alle


Code: [AUSKLAPPEN]

Graphics 640,480,16,2
SetBuffer BackBuffer()


Type blackhole
   Field x,y
   Field size,dir
   Field donotabsorb
End Type

Type time
   Field zeit,nummer
End Type

Const sizex = 639
Const sizey = 300

Global ri

;image = CreateImage(sizex,sizey)
Global time = CreateBank(sizex*sizey+1)
bank = CreateBank(sizex*sizey+1)



;b.blackhole = New blackhole
;b\x         = 200
;b\y         = 140
;b\size      = 200
;b\donotabsorb = 3

Global CountSalz=0
Global CountWasser=0
Global CountOil=0

Global tool$="Stein"
Global auswahl
Global lang
Global anz=1
Repeat
   Cls
   
   modul

;Text 10,10,"Mousex:"+MouseX()
;Text 10,20,"Mousey:"+MouseY()


   t=t+1
   
   CountSalz=CountSalz+KeyHit(22)-KeyHit(36)
   If CountSalz<0 Then CountSalz=CountSalz+6
   CountSalz=CountSalz Mod 6
   
   CountWasser=CountWasser+KeyHit(24)-KeyHit(38)
   If CountWasser<0 Then CountWasser=CountWasser+6
   CountWasser=CountWasser Mod 6
   
   CountOil=CountOil+KeyHit(23)-KeyHit(37)
   If CountOil<0 Then CountOil=CountOil+6
   CountOil=CountOil Mod 6
   
      If Not KeyDown(57)
      For c=1 To CountSalz
         PokeByte bank,(sizex/4+Rand(-20,20))*sizey+sizey-1,1
      Next
      For c=1 To CountWasser
         PokeByte bank,(sizex*3/4+Rand(-20,20))*sizey+sizey-1,2
      Next
      For c=1 To CountOil
         PokeByte bank,(sizex*2/4+Rand(-20,20))*sizey+sizey-1,4
      Next
   EndIf
   
   If MouseDown(1) And tool$="Stein" ; Wand erstellen
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,3
         Next
      Next
   ElseIf MouseDown(2) ; Löschen
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,0
         Next
      Next
   ElseIf KeyDown(2) ; Feuer!!
      For x = MouseX()-1 To MouseX()+1
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,5
         Next
      Next
   ElseIf MouseDown(1) And tool$="Gras" ; Grün
      For x = MouseX()-1 To MouseX()+1
         For y = MouseY()-1 To MouseY()+1
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,6
         Next
      Next
   ElseIf MouseDown(1) And tool$="Wolke" ; wolke
      For x = MouseX()-2 To MouseX()+2
         For y = MouseY()-2 To MouseY()+2
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,7
         Next
      Next
   ElseIf MouseDown(1) And tool$="Säure" ; säure
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,10
         Next
      Next
   ElseIf MouseDown(1) And tool$="Heizer" ; herd
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,11
         Next
      Next
   ElseIf MouseDown(1) And tool$="Kühler" ; kühler
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,12
         Next
      Next
    ElseIf MouseDown(1) And tool$="Glas" ; Glas
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,13
         Next
      Next
    ElseIf MouseDown(1) And tool$="Stahl" ; Glas
      For x = MouseX()-3 To MouseX()+3
         For y = MouseY()-3 To MouseY()+3
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then PokeByte bank,x*sizey+sizey-y,15
         Next
      Next

   EndIf
   
   UpdateSand(bank)
   
   UpdateBlackHoles(bank)
   
   fps# = (fps*19+1000/(MilliSecs()-ms))/20
   ms = MilliSecs()
   Color 255,255,255
   Text 500,0,fps
   Flip 0
Until KeyHit(1)
End

Function UpdateBlackHoles(bank)
   For b.blackhole = Each blackhole
      For i2 = 0 To 60
         le = Rand(b\size/2,b\size)
         dir# = Rnd(360)
         s# = Sin(dir)
         c# = Cos(dir)
         x2 = b\x
         y2 = b\y
         For i = 1 To le
            x = b\x + c*i
            y = b\y + s*i
            x2 = b\x + c*(i+1)
            y2 = b\y + s*(i+1)
            If x > 0 And y > 0 And x < sizex-1 And y < sizey-1 Then
               If x2 > 2 And y2 > 2 And x2 < sizex-3 And y2 < sizey-3 Then
                  t2 = PeekByte(bank,x2*sizey-y2)
               Else
                  t2 = 0
               EndIf
               If b\donotabsorb=0 Then
                  PokeByte bank,x*sizey-y,t2
               Else
                  If t2 = b\donotabsorb Then
                     t2=0
                  Else
                     t2 = PeekByte(bank,x2*sizey-y2)
                  EndIf
                  If PeekByte(bank,x*sizey-y) <> b\donotabsorb
                     PokeByte bank,x*sizey-y,t2
                  EndIf
               EndIf
            EndIf
            x2 = x
            y2 = y
         Next
         Line b\x,b\y,b\x+c*le,b\y+s*le
         Color 200,0,200
         Rect b\x-2,b\y-2,4,4
      Next
   Next
End Function

Function UpdateSand(bank)
   LockBuffer BackBuffer()
   
   For i = 1 To 1
      ri = 1-ri
      x = (sizex-1)*(ri=1)
      Ende = (sizex-1)*(ri=0)
      While (x < ende And ri = 0) Or (x > ende And ri = 1)
         If ri = 1 Then x = x - 1 Else x = x + 1
         typo = 1
         For y = 0 To sizey-1
            off = x*sizey+y
            typ = PeekByte(bank,off)
            showtyp = typ
            showtyp2 = PeekByte(bank,off+1)
           
           
           
            Select typ
            Case 1,2,4,10,14,13 ; salz, wasser, öl, säure
               moved = 0
               If typ = 10 And Rand(5)=5; ätzen
                  ; lösen!
                  If False ; rem
                     Select Rand(0,1)
                     Case 0
                        If x > 1 And x < sizex-2
                           typ2 = PeekByte(bank,off-sizey)
                           typ3 = PeekByte(bank,off+sizey)
                           If typ2 <> 2 And typ3 = 2 Then
                              PokeByte bank,off+sizey,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 2 And typ3 <> 2 Then
                              PokeByte bank,off-sizey,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 2 And typ3 <> 2 And Rand(1) And x > 2 And x < sizex-3
                              typ2 = PeekByte(bank,off-sizey*2)
                              typ3 = PeekByte(bank,off+sizey*2)
                              If typ2 <> 2 And typ3 = 2 Then
                                 PokeByte bank,off+sizey*2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 2 And typ3 <> 2 Then
                                 If Rand(1) Then PokeByte bank,off-sizey*2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     Case 1
                        If y > 1 And y < sizey-2
                           typ2 = PeekByte(bank,off-1)
                           typ3 = PeekByte(bank,off+1)
                           If typ2 <> 2 And typ3 = 2 Then
                              PokeByte bank,off+1,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 2 And typ3 <> 2 Then
                              PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 2 And typ3 <> 2 And Rand(1) And y > 2 And y < sizey-3
                              typ2 = PeekByte(bank,off-2)
                              typ3 = PeekByte(bank,off+2)
                              If typ2 <> 2 And typ3 = 2 Then
                                 PokeByte bank,off+2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 2 And typ3 <> 2 Then
                                 If Rand(1) Then PokeByte bank,off-2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     End Select ; endrem
                  Else
                     r = Rand(1,10)
                     Select r
                     Case 1
                        If x > 0 And y < sizey-1
                           typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 2
                        If y < sizey-1
                           typ2 = PeekByte(bank,off+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,off+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 3
                        If x < sizex-1 And y < sizey
                           typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y+1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey+1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 4
                        If x > 0
                           typ2 = PeekByte(bank,x*sizey-sizey+y)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 5
                        If x < sizex-1
                           typ2 = PeekByte(bank,x*sizey+sizey+y)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 6
                        If x > 0 And y >0
                           typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey-sizey+y-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-sizey-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 7
                        If y > 0
                           typ2 = PeekByte(bank,off-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     Case 8
                        If x < sizex-1 And y > 0
                           typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                           If typ2 = 2
                              If Rand(0,400) Then PokeByte bank,x*sizey+sizey+y-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ2 < 10 And Rand(0,1)
                              If Rand(0,1) Then PokeByte bank,off+sizey-1,typ
                              PokeByte bank,off,8
                              typ = 8
                           EndIf
                        EndIf
                     End Select
                  EndIf
               EndIf
               If typo = 0 Or typo = 8 Or typo=9 Or (typ=1 And (typo=2 Or typo=4)) Or (typ=2 And typo=4) Then
                  If typo = 0 Or Rand(0,1)
                     PokeByte bank,off,typo
                     PokeByte bank,off-1,typ
                     typ = typo
                  EndIf
               ElseIf y > 0
                  If typ = 2 Or typ = 4
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                     
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2) Or ((typ3=8 Or typ3=9) And Rand(0,2)=1))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2) Or ((typ2=8 Or typ2=9) And Rand(0,2)=1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                  EndIf
                  If typ = 2 Or typ = 4 Or typ = 10
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                 
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                     
                     If x < 1
                        typ3 = typ
                     Else
                        typ3 = PeekByte(bank,x*sizey-sizey+y)
                     EndIf
                     
                     If x > sizex-2
                        typ2 = typ
                     Else
                        typ2 = PeekByte(bank,x*sizey+sizey+y)
                     EndIf
                 
                     
                     If typ2 = typ And (typ3 = 0 Or (typ3 = 4 And typ=2))
                        PokeByte bank,off,typ3
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ3
                        moved = 1
                     ElseIf typ3 = typ And (typ2 = 0 Or (typ2 = 4 And typ=2))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                        moved = 1
                     EndIf
                  EndIf
           
                 
               
                  If Rand(1,2) = 1 And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y-1,typ
                        typ = typ2
                        moved = 1
                     ElseIf Rand(0,1) And x < sizex-3
                        typ2 = PeekByte(bank,x*sizey+sizey*2+y-1)
                        If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey+sizey*2+y-1,typ
                           typ = typ2
                           moved = 1
                        EndIf
                     EndIf
                  ElseIf x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey-sizey+y-1,typ
                        typ = typ2
                        moved = 1
                     ElseIf Rand(0,1) And x > 2
                        typ2 = PeekByte(bank,x*sizey-sizey*2+y-1)
                        If typ2 = 0 Or (typ2 = 2 And typ=1 And Rand(0,1)) Or (typ2 = 4 And Rand(0,1))
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey-sizey*2+y-1,typ
                           typ = typ2
                           moved = 1
                        EndIf
                     EndIf
                  EndIf
               EndIf
                If typ=14 Then
                  typ2 = PeekByte(bank,x*sizey+sizey*2+y-1)
                  typ4 = PeekByte(time,off)
                   If typ2=6 Or typ2=4 Then
                    PokeByte bank,off,5
                   EndIf
                   If typ2=11 Then
                     PokeByte bank,off,14
                   EndIf   
                      PokeByte(time,off,typ4-anz)
                   If typ4=1 Then
                      PokeByte(bank,off,13)
                   EndIf
                EndIf   
                 
             Case 5 ; feuer
               If Rand(50)=1
                  PokeByte bank,off,8
                  If PeekByte(bank,off+1) = 2 Then PokeByte bank,off,9
                  typ = 8
               ElseIf Rand(0,1) And y < sizey-2
                  typ2 = PeekByte(bank,off+1)
                  Select typ2
                  Case 0
                     If Rand(2)=2
                        PokeByte bank,off,typ2
                        PokeByte bank,off+1,typ
                        typ = typ2
                     EndIf
                  Case 1,11
                     If Rand(10)=2
                        PokeByte bank,off,0
                        typ = 0
                     EndIf
                  Case 2,12
                     PokeByte bank,off,9
                     typ = 9
                  Case 4,6
                     If Rand(0,1)
                        PokeByte bank,off+1,typ
                        typ = typ
                     EndIf
                  Case 13;Glas (schmelzen)
                      PokeByte bank,off+1,14
                      PokeByte time,off+1,50
                        typ = 14
                  End Select

               ElseIf Rand(0,1) And y > 1
                  If Rand(0,1) And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     Select typ2
                     Case 0
                        If Rand(20)=2
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey+sizey+y-1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2)=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey+sizey+y-1,typ
                           typ = typ
                        EndIf
                     End Select
                  ElseIf x > 1 And Rand(0,1)
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     Select typ2
                     Case 0
                        If Rand(20=2)
                           PokeByte bank,off,typ2
                           PokeByte bank,x*sizey-sizey+y-1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2)=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey-sizey+y-1,typ
                           typ = typ
                        EndIf
                     End Select
                  Else
                     typ2 = PeekByte(bank,off+1)
                     Select typ2
                     Case 0
                        If Rand(10)=5
                           PokeByte bank,off,typ2
                           PokeByte bank,off+1,typ
                           typ = typ2
                        EndIf
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        PokeByte bank,off,0
                        typ = 0
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,off+1,typ
                           typ = typ
                        EndIf
                     End Select
                  EndIf
               Else
                  If Rand(0,1) And x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     Select typ2
                     Case 0
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey+sizey+y,typ
                        typ = typ2
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2-(typ2=12))=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey+sizey+y,typ
                           typ = typ
                        EndIf
                     End Select
                  ElseIf x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     Select typ2
                     Case 0
                        PokeByte bank,off,typ2
                        PokeByte bank,x*sizey-sizey+y,typ
                        typ = typ2
                     Case 1,11
                        If Rand(10)=2
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 2,12
                        If Rand(2-(typ2=12))=1
                           PokeByte bank,off,0
                           typ = 0
                        EndIf
                     Case 4,6
                        If Rand(0,1)
                           PokeByte bank,x*sizey-sizey+y,typ
                           typ = typ
                        EndIf
                     End Select
                  EndIf
               EndIf
            Case 6 ; pflanze
               r = Rand(1,40)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y+1,0
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 2
                        PokeByte bank,off+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+y-1,0
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y+1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y+1,0
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y,0
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y,0
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey-sizey+y-1,0
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 2
                        PokeByte bank,off-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+y-1,0
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y-1,typ
                     ElseIf typ2 = 8 And Rand(1)
                        PokeByte bank,x*sizey+sizey+y-1,0
                     EndIf
                  EndIf
               Case 38
                  If Rand(20)=1 Then   PokeByte bank,off,4
               End Select
            Case 7 ; wolke
               If Rand(0,30)=4 And y > 1
                  typ2 = PeekByte(bank,off-1)
                  If typ2 = 0
                     PokeByte bank,off-1,2
                  EndIf
               EndIf
            Case 8,9,14 ; wasser/co2-gas
               moved = 0
               typo = PeekByte(bank,off+1)
               If Rand(300)=1 And typ = 9 Or typ=14 Then
                  typ = 2
                  PokeByte bank,off,typ
               Else
                  If y < sizey-1 And Rand(0,6)=2 And typo = 0 ;<> 3 And typo <> 6 And typo <> 7 And typo <> 11 And typo<>12
                     PokeByte bank,off,typo
                     If y < sizey-2 Then PokeByte bank,off+1,typ
                     typ = typo
                  Else ; expandieren
                     Select Rand(0,1)
                     Case 0
                        If x > 1 And x < sizex-2
                           typ2 = PeekByte(bank,off-sizey)
                           typ3 = PeekByte(bank,off+sizey)
                           If typ2 <> 0 And typ3 = 0 Then
                              PokeByte bank,off+sizey,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 0 And typ3 <> 0 Then
                              PokeByte bank,off-sizey,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 = 0 And typ3 = 0 And Rand(0,1) And y < sizey-1
                              typ2 = PeekByte(bank,off+1)
                              If typ2 Then
                                 Select Rand(0,1)
                                 Case 0
                                    PokeByte bank,off-sizey,typ
                                    PokeByte bank,off,0
                                    typ = 0
                                 Case 1
                                    PokeByte bank,off+sizey,typ
                                    PokeByte bank,off,0
                                    typ = 0
                                 End Select
                              ElseIf y < sizey-2
                                 typ2 = PeekByte(bank,off+2)
                                 If typ2 Then
                                    Select Rand(0,1)
                                    Case 0
                                       PokeByte bank,off-sizey,typ
                                       PokeByte bank,off,0
                                       typ = 0
                                    Case 1
                                       PokeByte bank,off+sizey,typ
                                       PokeByte bank,off,0
                                       typ = 0
                                    End Select
                                 EndIf
                              EndIf
                           ElseIf typ2 <> 0 And typ3 <> 0 And x > 2 And x < sizex-3 And False
                              typ2 = PeekByte(bank,off-sizey*2)
                              typ3 = PeekByte(bank,off+sizey*2)
                              If typ2 <> 0 And typ3 = 0 Then
                                 PokeByte bank,off+sizey*2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 0 And typ3 <> 0 Then
                                 PokeByte bank,off-sizey*2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     Case 1
                        If y > 1 And y < sizey-2
                           typ2 = PeekByte(bank,off-1)
                           typ3 = PeekByte(bank,off+1)
                           If typ2 <> 0 And typ3 = 0 Then
                              PokeByte bank,off+1,typ
                              PokeByte bank,off,typ3
                              typ = typ3
                           ElseIf typ2 = 0 And typ3 <> 0 Then
                              PokeByte bank,off-1,typ
                              PokeByte bank,off,typ2
                              typ = typ2
                           ElseIf typ2 <> 0 And typ3 <> 0 And Rand(1) And y > 2 And y < sizey-3 And False
                              typ2 = PeekByte(bank,off-2)
                              typ3 = PeekByte(bank,off+2)
                              If typ2 <> 0 And typ3 = 0 Then
                                 PokeByte bank,off+2,typ
                                 PokeByte bank,off,typ3
                                 typ = typ3
                              ElseIf typ2 = 0 And typ3 <> 0 Then
                                 PokeByte bank,off-2,typ
                                 PokeByte bank,off,typ2
                                 typ = typ2
                              EndIf
                           EndIf
                        EndIf
                     End Select
                  EndIf
               EndIf
            Case 11 ; herd
               r = Rand(1,10)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y+1,9
                     ElseIf typ2 > 1 And typ2 < 8  And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y+1,5
             
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 2
                        PokeByte bank,off+1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,off+1,5
                 
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y+1,9
                     ElseIf typ2 > 1 And typ2 < 8 And  typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y+1,5
                 
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y,5
                     
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y,9
                     ElseIf typ2 > 1 And typ2 < 8 And  typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y,5
                     
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey-sizey+y-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey-sizey+y-1,5
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 2
                        PokeByte bank,off-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,off-1,5
                   
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 2
                        PokeByte bank,x*sizey+sizey+y-1,9
                     ElseIf typ2 > 1 And typ2 < 8 And typ2 <> 5
                        PokeByte bank,x*sizey+sizey+y-1,5
                   
                     EndIf
                  EndIf
               End Select
            Case 12 ; kühler
               r = Rand(1,10)
               Select r
               Case 1
                  If x > 1 And y < sizey-2
                     typ2 = PeekByte(bank,x*sizey-sizey+y+1)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y+1,2
                     EndIf
                  EndIf
               Case 2
                  If y < sizey-2
                     typ2 = PeekByte(bank,off+1)
                     If typ2 = 9
                        PokeByte bank,off+1,2
                     EndIf
                  EndIf
               Case 3
                  If x < sizex-2 And y < sizey
                     typ2 = PeekByte(bank,x*sizey+sizey+y+1)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y+1,2
                     EndIf
                  EndIf
               Case 4
                  If x > 1
                     typ2 = PeekByte(bank,x*sizey-sizey+y)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y,2
                     EndIf
                  EndIf
               Case 5
                  If x < sizex-2
                     typ2 = PeekByte(bank,x*sizey+sizey+y)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y,2
                     EndIf
                  EndIf
               Case 6
                  If x > 1 And y >1
                     typ2 = PeekByte(bank,x*sizey-sizey+y-1)
                     If typ2 = 9
                        PokeByte bank,x*sizey-sizey+y-1,2
                     EndIf
                  EndIf
               Case 7
                  If y > 1
                     typ2 = PeekByte(bank,off-1)
                     If typ2 = 9
                        PokeByte bank,off-1,2
                     EndIf
                  EndIf
               Case 8
                  If x < sizex-2 And y > 1
                     typ2 = PeekByte(bank,x*sizey+sizey+y-1)
                     If typ2 = 9
                        PokeByte bank,x*sizey+sizey+y-1,2
                     EndIf
                  EndIf
               End Select
               
            End Select
           
           
            ;If iterations = i
            If showtyp2 <> showtyp ; hell
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $ffffff
               Case 2 ; wasser
                  col = $3065ff
               Case 3 ; stein
                  col = $c8c8c8
               Case 4 ; öl
                  col = $daa953
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $40ec61
               Case 7 ; wolke
                  col = $60c0ff
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $ff7498
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; Glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               Case 15
                  col = $333333
               End Select
               If col WritePixelFast x,sizey-y,col
            ElseIf typo2 <> showtyp ; dunkel
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $bbbbbb
               Case 2 ; wasser
                  col = $0000bb
               Case 3 ; stein
                  col = $555555
               Case 4 ; öl
                  col = $774400
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $009900
               Case 7 ; wolke
                  col = $1188aa
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $aa0000
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               Case 15
                  col = $333333
               End Select
               If col WritePixelFast x,sizey-y,col
            Else
               Select showtyp
               Case 0 ; nichts
                  col = 0
               Case 1 ; sand
                  col = $ccccaa
               Case 2 ; wasser
                  col = $0000ff
               Case 3 ; stein
                  col = $888888
               Case 4 ; öl
                  col = $aa9933
               Case 5 ; feuer
                  col = $ff8800
               Case 6 ; gras
                  col = $00cc11
               Case 7 ; wolke
                  col = $40a0ff
               Case 8 ; co2 (gas)
                  col = $604030
               Case 9 ; wasserdampf
                  col = $0030a0
               Case 10; säure
                  col = $ff0033
               Case 11; herd
                  col = $ed8640
               Case 12; kühler
                  col = $88ddff
               Case 13; Glas
                  col = $000099
               Case 14; Glas(gesch)
                  col = $FF0000
               Case 15
                  col = $333333
               End Select
               If col WritePixelFast x,sizey-y,col
            EndIf
            typo2 = showtyp
            typo = typ
         Next
      Wend
   Next
   
   UnlockBuffer BackBuffer()
End Function


Function modul()

If auswahl=1 Then

If MouseHit(1) And MouseX()>98 And MouseX()<111 Then
      If MouseY()>330 And MouseY()<343 Then tool$="Stein":auswahl=0
      If MouseY()>350 And MouseY()<363 Then tool$="Gras":auswahl=0
      If MouseY()>370 And MouseY()<383 Then tool$="Wolke":auswahl=0
      If MouseY()>390 And MouseY()<403 Then tool$="Säure":auswahl=0
      If MouseY()>410 And MouseY()<423 Then tool$="Heizer":auswahl=0
      If MouseY()>430 And MouseY()<443 Then tool$="Kühler":auswahl=0
      If MouseY()>450 And MouseY()<463 Then tool$="Glas":auswahl=0
      If MouseY()>470 And MouseY()<483 Then tool$="Stahl":auswahl=0
   EndIf

   Color 0,0,$888888
   Rect 98,330,13,13
   Color 0,0,$00cc11
   Rect 98,350,13,13
   Color 0,0,$40a0ff
   Rect 98,370,13,13
   Color 0,0,$ff0033
   Rect 98,390,13,13
   Color 0,0,$ed8640
   Rect 98,410,13,13
   Color 0,0,$88ddff
   Rect 98,430,13,13
   Color 0,0,$000099
   Rect 98,450,13,13
   Color 0,0,$333333
   Rect 98,470,13,13

   Color 255,255,255
   Text 120,330,"Stein"
   Text 120,350,"Gras"
   Text 120,370,"Wolke"
   Text 120,390,"Säure"
   Text 120,410,"Heizer"
   Text 120,430,"Kühler"
   Text 120,450,"Glas"
   Text 120,470,"Stahl"

   Text 10,330,"Auswählen:"

EndIf

If auswahl=0 Then
   If MouseHit(1) And MouseX()>98 And MouseX()<111 And MouseY()>330 And MouseY()<343 Then auswahl=1-auswahl   
   Text 50,330,"Tool:   "+tool$
   Select tool$
      Case "Stein"
         Color 0,0,$888888
      Case "Gras"
         Color 0,0,$00cc11
      Case "Wolke"
         Color 0,0,$40a0ff
      Case "Säure"
         Color 0,0,$ff0033
      Case "Heizer"
         Color 0,0,$ed8640
      Case "Kühler"
         Color 0,0,$88ddff
      Case "Glas"
         Color 0,0,$000099
      Case "Stahl"
         Color 0,0,$333333

   End Select
     
   Rect 98,330,13,13
   Color 255,255,255
EndIf


End Function
"Wenn die Menschen nur über das sprächen, was sie begreifen, dann würde es sehr still auf der Welt sein." Albert Einstein (1879-1955)
"If you live each day as if it was your last, someday you'll most certainly be right." Steve Jobs

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group