[B2d] Falling Sand Game

Übersicht BlitzBasic Codearchiv

Gehe zu Seite Zurück  1, 2, 3, 4, 5

Neue Antwort erstellen

5k41

BeitragFr, Dez 01, 2006 13:59
Antworten mit Zitat
Benutzer-Profile anzeigen
@Iguan:
Debugger aus und Leertaste ausprobieren...-.- hatten wir aber beides schon!
Projekte:
For a better World - Gesellschaftsspiel ( 100%)

User posted image

Pdd

BeitragFr, Dez 01, 2006 15:07
Antworten mit Zitat
Benutzer-Profile anzeigen
Das war das erste, was ich eingebaut hab, am anfang 2000 msec delay und mit spacebar kann man anhalten. Und was sindn das für smileys? xD Very Happy
Lieber Apfel als Birne.

FireballFlame

BeitragSa, Dez 02, 2006 0:46
Antworten mit Zitat
Benutzer-Profile anzeigen
Weihnachts-Smileys! Steht auch auf der Startseite Wink
Ich find die schick ^^

Was man tatsächlich mal machen könnte, wäre eine Verbesserung der Maussteuerung. Ich hab mir den Code zwar noch immer nicht angeschaut (einfach keine Zeit bisher), aber könnte man nicht mal die Maus in jedem Schleifendurchlauf "doppelt zeichnen" lassen? Also z.B. so:

Nicht: Code:
If KeyDown(28) Then zeichne_Pflanze MouseX(),MouseY()

Sondern: Code:
MausX=MouseX() : MausY=MouseY()
If KeyDown(28) Then
     zeichne_Pflanze (MausX+alt_MausX)/2,(MausY+alt_MausY)/2
     zeichne_Pflanze MausX,MausY
End If
alt_MausX=MausX() : alt_MausY=MausY


Oder gleich ganze Linien... wenns dadurch net zu langsam wird...
Wenn man beim zeichnen nämlich die Maus zu schnell bewegt, entstehen immer Löcher und das ist nicht schön... Razz
PC: Intel Core i7 @ 4x2.93GHz | 6 GB RAM | Nvidia GeForce GT 440 | Desktop 2x1280x1024px | Windows 7 Professional 64bit
Laptop: Intel Core i7 @ 4x2.00GHz | 8 GB RAM | Nvidia GeForce GT 540M | Desktop 1366x768px | Windows 7 Home Premium 64bit
  • Zuletzt bearbeitet von FireballFlame am Mo, Jan 22, 2007 23:46, insgesamt einmal bearbeitet

StepTiger

BeitragSa, Dez 02, 2006 0:58
Antworten mit Zitat
Benutzer-Profile anzeigen
linienalgorithmus?
Noch gestern standen wir am Abgrund, doch heute sind wir schon einen Schritt weiter.
Computer:
AMD Sempron 3000+; ATI Radeon 9800 Pro; 512 MB DDR RAM 400Mhz; Asus E7N8X-E Deluxe; Samsung 200GB HD 5.4ns acces t
Gewinner: BP Code Compo #2
Π=3.141592653589793238...<--- und das aus dem kopf Laughing
Seit der Earthlings-Diskussion überzeugter Fleisch(fr)esser.

Mr.Keks

BeitragMi, Dez 27, 2006 2:29
Antworten mit Zitat
Benutzer-Profile anzeigen
https://www.blitzforum.de/foru...221#225221

Die Maussteuerung habe ich übrigens wie hier vorgeschlagen verbessert Wink
MrKeks.net
 

Coffee

BeitragMi, Dez 27, 2006 14:41
Antworten mit Zitat
Benutzer-Profile anzeigen
also ich finds geil, nur schade dass ich keine mittlere maustaste habe.. habs lokal verändert...

hier mal n screen nach 1 stunde spielzeit:
http://img138.imageshack.us/im...eksai8.jpg

EDIT: wieso is es eig. so gemacht, dass der mittlere strom von oben nach ner gewisen zeit oder akiton aufhört`?
*Mjam*

Mr.Keks

BeitragMi, Dez 27, 2006 15:01
Antworten mit Zitat
Benutzer-Profile anzeigen
hmm, sollte er eigentlich nicht ^^. probier mal die neue version! (link siehe vor zwei posts)
MrKeks.net
 

Coffee

BeitragMi, Dez 27, 2006 15:07
Antworten mit Zitat
Benutzer-Profile anzeigen
mkay.. mach ich heut abend...muss jetz weg.. is aber echt lustig hab grad mal auflösung verändert... 1fps ;D und dann alles so gemmacht das es brennt...was hängengeblieben der pc..
*Mjam*
 

FWeinb

ehemals "ich"

BeitragMo, Jan 22, 2007 19:14
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo ich hatte mal nichts zutuhen und da habe ich mal noch nen Glas objekt ihr reingemacht

Code:

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

Gehe zu Seite Zurück  1, 2, 3, 4, 5

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group