Klick-Spiel (Nachahmung eines SPiels von lustich.de)

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

Kryan

Betreff: Klick-Spiel (Nachahmung eines SPiels von lustich.de)

BeitragFr, März 03, 2006 20:15
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo,
da ich nich wusste, wohin mit dem spiel, hier is es:

Code: [AUSKLAPPEN]
AppTitle "Click@It (All Rights By Cult-Soft)"

Graphics 200,260,0,2
SetBuffer BackBuffer()

schwierigkeit=1
.neueschwierigkeit
Dim Level(6,6)
Select schwierigkeit
Case 1 Restore stufe1
Case 2 Restore stufe2
Case 3 Restore stufe3
Case 4 Restore stufe4
Case 5 Restore stufe5
End Select
If schwierigkeit<>0 Then
 For y=1 To 5
  For x=1 To 5
   Read Level(x,y)
  Next
 Next
End If
ClsColor 255,128,0
HidePointer
Repeat
 Cls
 mh1=MouseHit(1)
 For x=1 To 5
  For y=1 To 5
   Select Level(x,y)
   Case 0 Color 255,255,255
   Case 1 Color 0,0,0
   End Select
   Rect x*30,y*30,18,18,1
   If MouseX()>x*30 And MouseY()>y*30 And MouseX()<x*30+18 And MouseY()<y*30+18 Then
    If mh1 Then
     Level(x-1,y)=Not Level(x-1,y)
     Level(x+1,y)=Not Level(x+1,y)
     Level(x,y)=Not Level(x,y)
     Level(x,y+1)=Not Level(x,y+1)
     Level(x,y-1)=Not Level(x,y-1)
    End If
   End If
  Next
 Next
 Color 0,0,128
 Text 10,180,"[Stufe 1]"
 Text 100,180,"[Stufe 2]"
 Text 10,200,"[Stufe 3]"
 Text 100,200,"[Stufe 4]"
 Text 10,220,"[Stufe 5]"
 Text 100,220,"[Löschen]"
 x=MouseX()
 y=MouseY()
 If x>10 And y>180 And x<10+StringWidth("[Stufe X]") And y<180+FontHeight() Then
  If mh1 Then
   schwierigkeit=1
   Goto neueschwierigkeit
  End If
 End If
 If x>100 And y>180 And x<100+StringWidth("[Stufe X]") And y<180+FontHeight() Then
  If mh1 Then
   schwierigkeit=2
   Goto neueschwierigkeit
  End If
 End If
 If x>10 And y>200 And x<10+StringWidth("[Stufe X]") And y<200+FontHeight() Then
  If mh1 Then
   schwierigkeit=3
   Goto neueschwierigkeit
  End If
 End If
 If x>100 And y>200 And x<100+StringWidth("[Stufe X]") And y<200+FontHeight() Then
  If mh1 Then
   schwierigkeit=4
   Goto neueschwierigkeit
  End If
 End If
 If x>10 And y>220 And x<10+StringWidth("[Stufe X]") And y<220+FontHeight() Then
  If mh1 Then
   schwierigkeit=5
   Goto neueschwierigkeit
  End If
 End If
 If x>100 And y>220 And x<100+StringWidth("[Stufe X]") And y<220+FontHeight() Then
  If mh1 Then
   schwierigkeit=0
   Goto neueschwierigkeit
  End If
 End If
 Color 255,0,0
 Oval MouseX()-2,MouseY()-2,4,4
 allesok=0
 For x=1 To 5
  For y=1 To 5
   If Level(x,y)=1 Then allesok=allesok+1
  Next
 Next
 If allesok=25 Then Text 10,240,"Gewonnen!"
 Flip
Until KeyHit(1)

.stufe1
Data 0,0,0,0,0
Data 0,0,0,0,0
Data 1,0,1,0,1
Data 0,0,0,0,0
Data 0,0,0,0,0
.stufe2
Data 0,0,0,0,0
Data 0,0,0,0,0
Data 0,0,1,0,0
Data 0,1,1,1,0
Data 1,1,1,1,1
.stufe3
Data 0,1,1,1,0
Data 1,0,0,0,1
Data 1,0,0,0,1
Data 1,0,0,0,1
Data 0,1,1,1,0
.stufe4
Data 0,0,1,0,0
Data 0,1,0,1,0
Data 1,0,1,0,1
Data 0,1,0,1,0
Data 0,0,1,0,0
.stufe5
Data 0,0,0,0,0
Data 0,0,0,0,0
Data 0,1,0,0,0
Data 0,1,0,0,0
Data 0,1,0,0,0


viel spaß ^^
hoffe er kann euch bei irgendwas helfen Smile
Webspaceanbieter?
Klick hier!
Kultige Spieleschmiede?
Klick hier!

aMul

Sieger des Minimalist Compo 01/13

BeitragMo, März 06, 2006 23:07
Antworten mit Zitat
Benutzer-Profile anzeigen
Da ich auch bei diesem "Wettbewerb" mitgemacht habe und ebenfals nicht weiß wohin mit dem Code, poster ich ihn einfach mal^^

Ich denke das mein Code vor allem für Anfänger ein bisschen übersichtlicher ist als der von Kryan(nichts gegen dich:)).
Ich habe bei diesem Code haupsächlich auf Geschwindigkeit geachtet, weshalb das Program bei mir ca 8000FPS erreicht.
Die verschieden Level habe ich allerdings weggelassen, da ich nicht mehr als 15Minuten investieren wollte^^

So, lange Rede kurzer Sinn, hier der Code:
Code: [AUSKLAPPEN]

AppTitle "Klicker"
Graphics 250,120,0,2

Dim feld(4,4)

bg=CreateImage(250,120)
   SetBuffer ImageBuffer(bg)
   ClsColor 0,0,200
   Cls
   Color 100,100,100
   For i=1 To 4
      Rect i*20+1,1,1,100
   Next
   For i=1 To 4
      Rect 1,i*20+1,100,1
   Next
   Rect 1,1,100,100,0
   Color 255,255,255
   For i=1 To 4
      Rect i*20,0,1,100
   Next
   For i=1 To 4
      Rect 0,i*20,100,1
   Next      
   Rect 0,0,101,101,0
    Text 105,0,"Versuche das Feld"
   Text 105,15,"zu füllen./Try to"
   Text 105,30,"fill the rect."
   
   
   Color 100,100,100
   Rect 111,81,130,20,0
   Color 0,0,200
   Rect 111,81,129,19,0
   Color 255,255,255
   Rect 110,80,130,20,0
   Text 175,89,"Löschen/Clear",1,1

rect1=CreateImage(15,15)
   SetBuffer ImageBuffer(rect1)
   Cls
   Color 100,100,100
   Rect 1,1,14,14,1
   Color 255,255,255
   Rect 0,0,14,14,1

win=CreateImage(128,14)
   SetBuffer ImageBuffer(win)
   Cls
   Color 255,0,0
   Text 64,7,"GEWONNEN/YOU WIN",1,1
   

SetBuffer BackBuffer()
Repeat
   
   If MouseHit(1)
      If MouseX()<100 And MouseY()<100
         x=Int(MouseX()/20)
         y=Int(MouseY()/20)
         feld(x,y)=1-feld(x,y)
         If x<4 feld(x+1,y)=1-feld(x+1,y)
         If y<4 feld(x,y+1)=1-feld(x,y+1)
         If x>0 feld(x-1,y)=1-feld(x-1,y)
         If y>0 feld(x,y-1)=1-feld(x,y-1)
      ElseIf MouseY()>80 And MouseX()>110 And MouseX()<240 And MouseY()<100
         For x=0 To 4
            For y=0 To 4
               feld(x,y)=0
            Next
         Next
      EndIf
   EndIf
   
   If KeyHit(88) fps=1-fps
   
   loops = loops+1
   If MilliSecs() - fpstime > 1000
      fpsrate = loops
      loops = 0
      fpstime = MilliSecs()
   End If

   DrawBlock bg,0,0
      
   anzahl=0
   
   For x=0 To 4
      For y=0 To 4
         If feld(x,y)=1
            DrawBlock rect1,x*20+3,y*20+3
            anzahl=anzahl+1
         EndIf
      Next
   Next
   
   Color 255,255,255
   If fps fpstext$=Str(fpsrate)+"fps":Text 245-StringWidth(fpstext),104,fpstext
   
   If anzahl=25 DrawBlock win,111,53   
   
   
   Flip 0
   
Until KeyHit(1)

End
Panic Pong - ultimate action mashup of Pong and Breakout <= aktives Spiele-Projekt, Downloads mit vielen bunten Farben!
advASCIIdraw - the advanced ASCII art program <= aktives nicht-Spiele-Projekt, must-have für ASCII/roguelike/dungeon-crawler fans!
Alter BB-Kram: ThroughTheAsteroidBelt - mit Quelltext! | RGB-Palette in 32²-Textur / Farbige Beleuchtung mit Dot3 | Stereoskopie in Blitz3D | Teleport-Animation Screensaver

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group