Mein Verschwundenes Snake
Übersicht

c64Betreff: Mein Verschwundenes Snake |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
AUßER WERTUNG !!
Code: [AUSKLAPPEN] Global sx=800,sy=600 Graphics sx,sy,32 Global ft=CreateTimer(60),hi=1500,bs=2.0,px,cx,cy,d,ng,kp,fc,tc,gds,fn1=LoadFont("comic sans ms",19,1),fn2=LoadFont("comic sans ms",40,1),tx$ Dim po(2500,4),p(10),gd(100,10),ob(10),fx(1001,10) SetFont fn1 For c=0 To 10 ob(c)=CreateImage (28,28) SetBuffer ImageBuffer(ob(c)) Select c Case 0,4 For x=0 To 13 Color 60,100+x*6,10 Oval 15-x/2.1,15-x/2,x,x,0 Next Case 1,2,3 For x=0 To 15 Color 200-x*5,50+x*8,50+x*10 If c=2 Color 250-x*5,50,50+x*5 If c=3 Color 150,250,150+x*5 Oval 15-x/2,15-x/2,x,x,0 Next If c=1 Color 130,250,100 Text 15,14,"P",1,1 If c=2 Color 230,250,100 Text 15,14,"S",1,1 If c=3 Color 250,50,50 Text 15,15,"B",1,1 Oval 15-14/2,15-14/2,14,14,0 End Select If c<>4 ScaleImage ob(c),.9,.9 Next SetFont fn2 SetBuffer BackBuffer() While Not KeyHit(1) FlushKeys WaitTimer (ft) If p(8)>hi hi=p(8) tx$="SNAKE HI-Score "+hi Cls b Text sx-270,sy-40,"FRESEL@WEB.DE" For c=1 To p(10) DrawImage ob(4),10+c*30,sy-30 Next If kp=0 And p(10)>0 cp If p(10)>0 dp:g If p(10)<1 tc=(tc+4) Mod 360 For c=1 To Len(tx$) For b=1 To 10 Color 10,150+Cos(b*(c)+tc)*100,10 Text 130+c*25,sy/2+Sin(tc+c*15+b)*14+b,Mid$(tx$,c,1) Next Next If GetKey() >0 p(10)=3 p(1)=sx/28*14 p(2)=sy/28*14 p(3)=5 p(5)=10 p(6)=0 p(8)=0 p(7)=0 SeedRnd(MilliSecs()) EndIf Color 50,200,50 Text sx/2+1,30+2,p(8),1,1 gfx ks Flip Wend Function cp() If KeyDown (200)=1 p(0)=2 If KeyDown (208)=1 p(0)=3 If KeyDown (203)=1 p(0)=1 If KeyDown (205)=1 p(0)=0 If p(7)>0 p(8)=p(8)+1 p(7)=p(7)-1 p(4)=p(4)+1 If p(4)>Int(p(3)) p(4)=0 If bs>2 bs=bs-2 Select p(0) Case 0 p(1)=p(1)+14 cx=(cx-bs) Mod -56 Case 1 p(1)=p(1)-14 cx=(cx+bs) Mod 56 Case 2 p(2)=p(2)-14 cy=(cy+bs) Mod 56 Case 3 p(2)=p(2)+14 cy=(cy-bs) Mod -56 End Select If p(1)>sx p(1)=0 If p(1)<0 p(1)=sx-16 If p(2)>sy p(2)=0 If p(2)<0 p(2)=sy-13 If p(6)<p(5) po(p(6),0)=1 po(p(6),1)=p(1) po(p(6),2)=p(2) p(6)=p(6)+1 Else For c=0 To p(6) po(c,0)=po(c+1,0) po(c,1)=po(c+1,1) po(c,2)=po(c+1,2) Next EndIf po(p(6)-1,0)=1 po(p(6)-1,1)=p(1) po(p(6)-1,2)=p(2) EndIf End Function Function dp() Color 200,250,200 If kp=0 DrawImage ob(0),p(1),p(2) ch=0 For c=0 To p(6)-2 If po(c,0)>0 DrawImage ob(0),po(c,1),po(c,2) ch=ImagesCollide (ob(0),p(1),p(2),0,ob(0),po(c,1),po(c,2),0) If ch=1 kp=1 Next End Function Function g() If ng=0 gds=gds+1 If gds>100 gds=0 gd(gds,0)=1 If p(9)>2 gd(gds,0)=Rnd(2,3) p(9)=0 gd(gds,1)=Int(Rnd(.5,(sx-264)*.1))*14 gd(gds,2)=Int(Rnd(.5,(sy-190)*.1))*14 gd(gds,4)=Rnd(2,5)*150 ng=1 EndIf ch=0 For c=0 To 100 If gd(c,0)>0 If gd(c,4)>0 gd(c,4)=gd(c,4)-1 If gd(c,4)=0 ng=0 gd(c,0)=0 DrawImage ob(gd(c,0)),gd(c,1),gd(c,2) ch=ImagesCollide (ob(0),p(1),p(2),0,ob(gd(c,0)),gd(c,1),gd(c,2),0) If ch=1 bs=24 fc=fc+1 fx(fc,5)=gd(c,0) fx(fc,0)=1 fx(fc,1)=gd(c,1) fx(fc,2)=gd(c,2)-14 fx(fc,3)=10 fx(fc,4)=4 ng=0 If gd(c,0)=1 p(5)=p(5)+15 p(7)=p(7)+50 p(9)=p(9)+1 p(3)=p(3)-.4 If gd(c,0)=2 p(3)=p(3)-1 p(7)=p(7)+250 If gd(c,0)=3 p(7)=p(7)+500 gd(c,0)=0 End If EndIf Next End Function Function gfx() If fc>1000 fc=0 For c=0 To 1000 If fx(c,0)>0 wx=250-fx(c,0) fx(c,0)=fx(c,0)+fx(c,4) For c1=1 To 36 Step 2 If fx(c,5)=1 Color wx,wx-20,wx-20 Text fx(c,1)+Sin(c1*40+fx(c,0))*(fx(c,0)*.8),fx(c,2)+Cos(c1*20)*(fx(c,0)*.3),"POINTS",1,1 Text fx(c,1)+Sin(c1*40-fx(c,0))*(fx(c,0)*.8),fx(c,2)+Cos(c1*20)*(fx(c,0)*.3),"50",1,1 EndIf If fx(c,5)=2 Color wx*.6,wx*1.2,wx-20 Text fx(c,1)+Sin(c1*200+fx(c,0)*.3)*(fx(c,0)*.7),fx(c,2)+Cos(c1*200)*(fx(c,0)*.4),"SPEED",1,1 Text fx(c,1)+Sin(c1*200-fx(c,0)*.3)*(fx(c,0)*.7),fx(c,2)+Cos(c1*200)*(fx(c,0)*.4),"UP",1,1 EndIf If fx(c,5)=3 Color wx,200,wx-20 Text fx(c,1)+Sin(c1*200+fx(c,0)*.2)*(fx(c,0)*.8),fx(c,2)+Cos(c1*200+fx(c,0)*.4)*(fx(c,0)*.6),"BONUS",1,1 Text fx(c,1)+Sin(c1*200-fx(c,0)*.2)*(fx(c,0)*.8),fx(c,2)+Cos(c1*200-fx(c,0)*.4)*(fx(c,0)*.6),"500",1,1 EndIf For gl=0 To fx(c,4) gx=Rnd(-1*fx(c,0),1*fx(c,0))*.3 gy=Rnd(-1*fx(c,0),1*fx(c,0))*.3 Color 250-gl*5,250-gl*5,130-gl*5 If fx(c,5)<>4 Plot fx(c,1)+gx+Sin(c1*10)*(fx(c,0)*.04),fx(c,2)+gy+Cos(c1*10)*(fx(c,0)*.04) If fx(c,5)=4 Plot fx(c,1)+gx+Sin(c1*10)*(fx(c,0)*.04),fx(c,0)+fx(c,2)+gy+Cos(c1*10)*(fx(c,0)*.04) Next Next If fx(c,0)>200 fx(c,0)=0 fx(c,5)=0 EndIf Next End Function Function ks() If kp=1 If po(d,0)>0 fc=fc+1 fx(fc,0)=1 fx(fc,1)=po(d,1)+14 fx(fc,2)=po(d,2)+14 fx(fc,3)=Rnd(1,5) fx(fc,4)=Rnd(1,5) po(d,0)=0 If d<p(5) d=d+1 If d=p(5) d=0 kp=0 p(6)=1 p(3)=5 p(10)=p(10)-1 EndIf End Function Function b() x=-128 y=-100 px=px+1 Mod 359 For c=1 To 3590/2 pa=(1-pa) Color 140+Sin(((x+y)+px)*.1)*100,80-Sin(px*pa)*10,140+Cos(((y+x)+px)*.1)*100 Rect x+cx,y+cy,27,27 x=X+28 If x> sx+300 x=-100 y=y+28 Next End Function |
||
![]() |
Shadow of the night |
![]() Antworten mit Zitat ![]() |
---|---|---|
Bei dem Code soll noch wer draus kommen??
Also mir wird fast schlecht wenn ich da drein schau! |
||
User posted image |
c64 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hmm musst Du Basic Lernen !!! | ||
c64 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Und ausserdem ist das nur n Prog und kein Tutorial !
niemand ausser ich MUSS !! meinen COde esen können !! (es sei denn es ist notwendig!!!) ,anderen will ich das nicht vorenthalten Aber wenn du das lesen willst musst du dein Köpfchen schon Anstrengen ausserdem ist das kein Heavy C++ Code sondern "Nur" Simpler Basic Syntax ! Ps : Fass Das nich Böse auf !!!!! Und Nächstemal schreib lieber keinen kommentar als so einen !!! |
||
![]() |
Travis |
![]() Antworten mit Zitat ![]() |
---|---|---|
Naja, ein bisschen könnte man ja schon auf das Format achten, wie soll man denn sonst selbst noch durchsteigen. ![]() Ich habe auch mal ein Snakeclone entworfen: Code: [AUSKLAPPEN] ; Snake-2D v1.0 Final ; Copyright (C) Dez 2003, Daniel Nobis Graphics 320, 240, 16, 2 AppTitle "Snake-2D v1.0" SetBuffer BackBuffer() File = OpenFile("Game.dat") If Not File = 0 Then Datei = ReadFile("Game.dat") Highscore = ReadShort(Datei) Blocks = ReadByte(Datei) Speed = ReadByte(Datei) CloseFile Datei EndIf If File = 0 Then Highscore = 0 Blocks = 50 Speed = 50 EndIf .Anfang If Punkte > Highscore Then Highscore = Punkte m = 1 Type snake Field x,y End Type Type block Field x,y End Type For s.snake = Each snake Delete s Next For b.block = Each block Delete b Next ; --- Hauptmenü --- Repeat Cls Color 0,255,0 Text 100,8, "S N A K E 2 D" Text 35,220, "Copyright (C) 2003 Daniel Nobis" Color 255,255,255 Text 80,140, "Highscore: " + Highscore + " Punkte" Color 0,0,0 Locate 0,0: Print m; Debug Color 255,255,255 If m = 1 Then Color 255,255,0 Text 110,45, "Neues Spiel" Color 255,255,255 If m = 2 Then Color 255,255,0 Text 115,65, "Parameter" Color 255,255,255 If m = 3 Then Color 255,255,0 Text 135,85, "Ende" Color 255,255,255 If m = 5 Then Color 255,255,0 Text 30, 190, "Speed: " + Speed Color 255,255,255 If m = 6 Then Color 255,255,0 Text 210, 190, "Blöcke: " + Blocks Color 255,0,0 For x = 20 To 300 Step 4 Rect x, 30, 4, 4 Rect x, 210, 4, 4 Next For y = 32 To 210 Step 4 Rect 20, y, 4, 4 Rect 300, y, 4, 4 Next WaitKey Color 255,255,0 If m = 5 And KeyDown(28) Then Locate 30,190: Speed = Input("Speed: ") If m = 6 And KeyDown(28) Then Locate 210,190: Blocks = Input("Blöcke: ") If Speed > 100 Then Speed = 100 If Speed < 0 Then Speed = 0 If Blocks > 255 Then Blocks = 255 If Blocks < 0 Then Blocks = 0 If m = 1 And KeyDown(28) Then Goto Spiel If m = 2 And KeyDown(28) Then m = 5 If m = 3 And KeyDown(28) Then Goto Ende If KeyHit(200) Then m = m - 1 If KeyHit(208) Then m = m + 1 If m = 4 Then m = 1 If m = 0 Then m = 3 If m = 7 Then m = 5 If m = 4 Then m = 6 Flip If KeyHit(1) Then Goto Ende Forever ; --- Hauptmenü Ende --- .Spiel SeedRnd MilliSecs() For i = 1 To blocks b.block = New block b\x = Rnd(0,320) b\y = Rnd(0,240) b\x = b\x-(b\x Mod 4) b\y = b\y-(b\y Mod 4) Next zx = Rnd(0,320) zy = Rnd(0,240) zx = zx-(zx Mod 4) zy = zy-(zy Mod 4) x = 100 y = 100 Punkte = 0 n = 0 lang = 5 m = 2 Repeat Cls Color 255,255,255 Text 0,0, "Punkte: " + Punkte If KeyHit(200) Then m=8 If KeyHit(208) Then m=2 If KeyHit(203) Then m=4 If KeyHit(205) Then m=6 If m = 8 Then y = y - 4 If m = 2 Then y = y + 4 If m = 4 Then x = x - 4 If m = 6 Then x = x + 4 If x > 320 Then x = 0 If x < 0 Then X = 320 If y > 240 Then y = 0 If y < 0 Then y = 240 ; Kollisionsabfragen ; Schlange For s.snake = Each snake If x = s\x And y = s\y Then Delay 500 Locate 100,120: Print "G A M E O V E R" FlushKeys: WaitKey: Goto Anfang EndIf Next ; Ziel If x = zx And y = zy Then lang = lang + 10 Punkte = Punkte + 9 zx = Rnd(0,320) zy = Rnd(0,240) zx = zx-(zx Mod 4) zy = zy-(zy Mod 4) EndIf ; Hindernisse For b.block = Each block If x = b\x And y = b\y Then Delay 500 Locate 100, 120: Print "G A M E O V E R" FlushKeys: WaitKey: Goto Anfang EndIf Next ; Schlangenteil erstellen s.snake = New snake s\x = x s\y = y n = n + 1 ; Letzten Teile löschen If n > lang Then s.snake = First snake Delete s n = n - 1 EndIf ; Schlange zeichnen Color 255,255,0 For s.snake = Each snake Rect s\x-2, s\y-2, 4, 4 Next ; Ziel zeichnen Color 0,255,0 Oval zx-2, zy-2, 4, 4 ; Hindernisse zeichnen Color 0,0,255 For b.block = Each block Rect b\x-2, b\y-2, 4, 4 Next Delay 100 - Speed Flip Until KeyHit(1) Goto Anfang .Ende Datei = WriteFile("Game.dat") WriteShort Datei, Highscore WriteByte Datei, Blocks WriteByte Datei, Speed CloseFile Datei End |
||
www.funforge.org
Ich hasse WASD-Steuerung. Man kann alles sagen, man muss es nur vernünftig begründen können. |
![]() |
DivineDominion |
![]() Antworten mit Zitat ![]() |
---|---|---|
Vergesst nicht, dass es ein 4000 Zeichen contest war. Da hat man weder Platz für unnötige Kommentare noch für übermäßig viele Tab-Stops | ||
![]() |
Mike Nike |
![]() Antworten mit Zitat ![]() |
---|---|---|
Travis, dein Snake mag ich. Klein, kompakt und doch so funktionstüchtig.
Wie ein kleines Gameboyspielchen. Variable Geschwindigkeit und Schwierigkeitsstufe. Reibungsloser Spielablauf, man braucht zwar gute Augen, aber es lässt sich gut spielen. |
||
..where the only limit is your imagination. |
![]() |
Travis |
![]() Antworten mit Zitat ![]() |
---|---|---|
![]() Ich wollte auch erst bei dem Wettbewerb mitmachen, aber irgendwie fehlt dem Spiel noch der besondere Kick. Vielleicht hätte ich anstatt zufällige Blöcke kleine Levels programieren sollen. |
||
www.funforge.org
Ich hasse WASD-Steuerung. Man kann alles sagen, man muss es nur vernünftig begründen können. |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group