piXelfield
Übersicht

konstantinBetreff: piXelfield |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich hab mich mal an einem kleinen Sternenfeld versucht. Es hat 3 verschiedene Sternengrößen, farben und geschweindigkeiten.
Code: [AUSKLAPPEN] ; Starfield "Pixelfield" by Alu-Folie
; (c) 2003 by Alu-Folie InitGraphics( "Pixelfield by Alu-Folie", 640, 480, 16, 2 ) Dim Starfield( 100, 3 ) InitStarfield( 100 ) Repeat Cls DrawStarfield() UpdateStarfield() Flip Until( KeyHit( 1 ) ) End Function InitGraphics( AppName$, gwidth, gheight, gdeep, gmode ) AppTitle( AppName$ ) Graphics( gwidth, gheight, gdeep, gmode ) SetBuffer( BackBuffer() ) HidePointer End Function Function InitStarfield( StarNumber ) For StarCount = 0 To 100 Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, 640 ) Starfield( StarCount, 2 ) = Rand( 0, 480 ) Starfield( StarCount, 3 ) = Rand( 0, 2 ) Next End Function Function DrawStarfield() For StarCount = 0 To 100 If Starfield( StarCount, 0 ) = 1 Then If Starfield( StarCount, 3 ) = 2 Then Color 255, 255, 255 Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, 5, 1 End If If Starfield( StarCount, 3 ) = 1 Then Color 200, 200, 200 Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, 3, 1 End If If Starfield( StarCount, 3 ) = 0 Then Color 230, 230, 230 Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, 1, 1 End If End If Next End Function Function UpdateStarfield() For StarCount = 0 To 100 If Starfield( StarCount, 0 ) = 1 Then If Starfield( StarCount, 3 ) = 2 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 3 End If If Starfield( StarCount, 3 ) = 1 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 2 End If If Starfield( StarCount, 3 ) = 0 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 1 End If If Starfield( StarCount, 2 ) > 480 Then Starfield( StarCount, 0 ) = 0 If Starfield( StarCount, 0 ) = 0 Then Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, 640 ) Starfield( StarCount, 2 ) = 0 Starfield( StarCount, 3 ) = Rand( 0, 2 ) End If End If Next End Function |
||
- Zuletzt bearbeitet von konstantin am Fr, Dez 26, 2003 20:37, insgesamt einmal bearbeitet
![]() |
Shadow of the night |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hei werd ich in meinen nächsten Weltraumshooter einbauen (falls es erlaubt ist)
Ich finde bloss die vordersten Sterne ein wenig zu gross |
||
User posted image |
![]() |
Mr.Keks |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] ; Starfield "Pixelfield" by Alu-Folie
; 2003 by Alu-Folie ; verändert von Inarie Const main_width = 640 Const main_height = 480 Global fps_frames,fps_ms=MilliSecs(),fps_anzeige# InitGraphics( "Pixelfield by Alu-Folie", main_width, main_height, 16, 2 ) Const star_num = 2000 Dim Starfield( star_num, 3 ) InitStarfield( star_num ) Global star_color[2] star_color[0] = 0*$1000000 + 210*$10000 + 210*$100 + 210 star_color[1] = 0*$1000000 + 150*$10000 + 150*$100 + 150 star_color[2] = 0*$1000000 + 255*$10000 + 255*$100 + 255 Repeat Cls DrawStarfield() UpdateStarfield() Text 0,0,fps() Flip; 0 ; du kannst gerne mal die vsync abschalten ;) Until( KeyHit( 1 ) ) End Function InitGraphics( AppName$, gwidth, gheight, gdeep, gmode ) AppTitle( AppName$ ) Graphics( gwidth, gheight, gdeep, gmode ) SetBuffer( BackBuffer() ) HidePointer End Function Function Fps() fps_frames=fps_frames+1 If MilliSecs()-fps_ms >= 1000 Then fps_anzeige=fps_frames fps_frames=0 fps_ms=MilliSecs() EndIf Return fps_anzeige End Function Function InitStarfield( StarNumber ) For StarCount = 0 To starnumber Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width ) Starfield( StarCount, 2 ) = Rand( 0, main_height ) Starfield( StarCount, 3 ) = Rand( 0, 2 ) Next End Function Function DrawStarfield() LockBuffer ;BackBuffer() For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then tlen = starfield(starcount,3)*2+1 For i = 1 To tlen WritePixelFast Starfield( StarCount, 1 ), Starfield( StarCount, 2 )+i,star_color[starfield(starcount,3)] Next ;Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, , 1 End If Next UnlockBuffer ;BackBuffer() End Function Function UpdateStarfield() For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then If Starfield( StarCount, 3 ) = 2 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 3 End If If Starfield( StarCount, 3 ) = 1 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 2 End If If Starfield( StarCount, 3 ) = 0 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 1 End If If Starfield( StarCount, 2 ) > main_height-3 Then Starfield( StarCount, 0 ) = 0 If Starfield( StarCount, 0 ) = 0 Then Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width-1 ) Starfield( StarCount, 2 ) = 0 Starfield( StarCount, 3 ) = Rand( 0, 2 ) End If End If Next End Function ich war so frei eine kleine geschwindigkeits und handlingänderungen vorzunehmen ![]() |
||
MrKeks.net |
walskiEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
AHHH! Benutzt WritePixelFast bitte richtig!
Du mals mit deinem Programm in den Mauszeiger... also nach dem Ablaufen habe ich n Sternenfeld als Mauszeiger... Naja, ich denke mal irgendwo gehst du außerhalb des Zeichenbereichs was zwar manchma n Memory Access Violation produziert aber manchmal eben auch nur son komisches Cursor gemale! walski |
||
buh! |
konstantin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
@Shadow of the Night: Natürlich isses erlaubt, wenn dus unbedingt haben willst ![]() @Inarie: Nee, bei mir ist kein Speedunterschied - liegt wahrscheinlich wieder an meiner GraKa ![]() |
||
![]() |
Mr.Keks |
![]() Antworten mit Zitat ![]() |
---|---|---|
@walski: öhm, eigentlich müssten die teile alle gelöscht werden, sobald sie an den bildschirmrand kommen, was bei mir auch passiert... habe doch die updatefunktion auch angepasst. hmm, die erstellungsroutine habe ich nicht angepasst, aber die dürfte nur für wenige frames einen fehler verursachen.
@alu: du musst deins auch auf 2000 sterne schalten, einen fpszähler reincoden und flip 0 benutzen. dann siehst du es ![]() Code: [AUSKLAPPEN] ; Starfield "Pixelfield" by Alu-Folie
; 2003 by Alu-Folie ; verändert von Inarie Const main_width = 640 Const main_height = 480 Global fps_frames,fps_ms=MilliSecs(),fps_anzeige# InitGraphics( "Pixelfield by Alu-Folie", main_width, main_height, 16, 2 ) Const star_num = 2000 Dim Starfield( star_num, 3 ) InitStarfield( star_num ) Global star_color[2] star_color[0] = 0*$1000000 + 210*$10000 + 210*$100 + 210 star_color[1] = 0*$1000000 + 150*$10000 + 150*$100 + 150 star_color[2] = 0*$1000000 + 255*$10000 + 255*$100 + 255 Repeat Cls DrawStarfield() UpdateStarfield() Text 0,0,fps() Flip; 0 ; du kannst gerne mal die vsync abschalten ;) Until( KeyHit( 1 ) ) End Function InitGraphics( AppName$, gwidth, gheight, gdeep, gmode ) AppTitle( AppName$ ) Graphics( gwidth, gheight, gdeep, gmode ) SetBuffer( BackBuffer() ) HidePointer End Function Function Fps() fps_frames=fps_frames+1 If MilliSecs()-fps_ms >= 1000 Then fps_anzeige=fps_frames fps_frames=0 fps_ms=MilliSecs() EndIf Return fps_anzeige End Function Function InitStarfield( StarNumber ) For StarCount = 0 To starnumber Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width-2 ) Starfield( StarCount, 2 ) = Rand( 0, main_height-5 ) Starfield( StarCount, 3 ) = Rand( 0, 2 ) Next End Function Function DrawStarfield() LockBuffer ;BackBuffer() For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then tlen = starfield(starcount,3)*2+1 For i = 1 To tlen WritePixelFast Starfield( StarCount, 1 ), Starfield( StarCount, 2 )+i,star_color[starfield(starcount,3)] Next ;Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, , 1 End If Next UnlockBuffer ;BackBuffer() End Function Function UpdateStarfield() For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then If Starfield( StarCount, 3 ) = 2 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 3 End If If Starfield( StarCount, 3 ) = 1 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 2 End If If Starfield( StarCount, 3 ) = 0 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 1 End If If Starfield( StarCount, 2 ) > main_height-5 Then Starfield( StarCount, 0 ) = 0 If Starfield( StarCount, 0 ) = 0 Then Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width-1 ) Starfield( StarCount, 2 ) = 0 Starfield( StarCount, 3 ) = Rand( 0, 2 ) End If End If Next End Function nochmal mit einigen geänderten werten. jetzt kann eigentlich nichts mehr aus dem bereich kommen, walski |
||
MrKeks.net |
konstantin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Nee, Inarie, kein Unterschied ![]() ![]() |
||
![]() |
Mr.Keks |
![]() Antworten mit Zitat ![]() |
---|---|---|
wieviel fps hast du denn? und du hast auch den debugger aus und so? finde ich jetzt echt komisch, war bei mir wie gesagt wesentlich schneller, obwohl ich auch ne scheißgraka habe ![]() |
||
MrKeks.net |
![]() |
Travis |
![]() Antworten mit Zitat ![]() |
---|---|---|
Daraus könnte man ja jetzt Schneeflocken machen, die auf dem Boden liegen bleiben. Ich habe soetwas mal in QuickBasic gesehen. Die haben dann auch Häufchen gebildet und die Flocken sind ähnlich wie Sand nach unten gerutscht. | ||
www.funforge.org
Ich hasse WASD-Steuerung. Man kann alles sagen, man muss es nur vernünftig begründen können. |
![]() |
Mr.Keks |
![]() Antworten mit Zitat ![]() |
---|---|---|
so in der art? ![]() Code: [AUSKLAPPEN] ; Starfield "Pixelfield" by Alu-Folie
; 2003 by Alu-Folie ; verändert von Inarie ; nochmal von inarie zum schneefall verändert Const main_width = 640 Const main_height = 480 Global fps_frames,fps_ms=MilliSecs(),fps_anzeige# InitGraphics( "Pixelfield by Alu-Folie", main_width, main_height, 16, 2 ) Global gfx_boden = CreateImage(main_width,300) Global gfx_bmaskc= 255*$1000000 + 0*$10000 + 0*$100 + 0 SetBuffer ImageBuffer(gfx_boden) Oval 200,200,main_width-400,200 SetBuffer BackBuffer() Const star_num = 3000 Dim Starfield( star_num, 3 ) InitStarfield( star_num ) Global star_color[2] star_color[0] = 0*$1000000 + 230*$10000 + 230*$100 + 230 star_color[1] = 0*$1000000 + 210*$10000 + 210*$100 + 210 star_color[2] = 0*$1000000 + 255*$10000 + 255*$100 + 255 Repeat Cls DrawImage gfx_boden,0,main_height-300 DrawStarfield() UpdateStarfield() Text 0,0,fps() Flip; 0 ; du kannst gerne mal die vsync abschalten ;) Until( KeyHit( 1 ) ) End Function InitGraphics( AppName$, gwidth, gheight, gdeep, gmode ) AppTitle( AppName$ ) Graphics( gwidth, gheight, gdeep, gmode ) SetBuffer( BackBuffer() ) HidePointer End Function Function Fps() fps_frames=fps_frames+1 If MilliSecs()-fps_ms >= 1000 Then fps_anzeige=fps_frames fps_frames=0 fps_ms=MilliSecs() EndIf Return fps_anzeige End Function Function InitStarfield( StarNumber ) For StarCount = 0 To starnumber Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width-2 ) Starfield( StarCount, 2 ) = Rand( 0, main_height-120 ) Starfield( StarCount, 3 ) = Rand( 0, 2 ) Next End Function Function DrawStarfield() LockBuffer ;BackBuffer() For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then WritePixelFast Starfield( StarCount, 1 ), Starfield( StarCount, 2 ),star_color[starfield(starcount,3)] ;Rect Starfield( StarCount, 1 ), Starfield( StarCount, 2 ), 1, , 1 End If Next UnlockBuffer ;BackBuffer() End Function Function UpdateStarfield() SetBuffer ImageBuffer(gfx_boden) LockBuffer For StarCount = 0 To star_num If Starfield( StarCount, 0 ) Then If Starfield( StarCount, 3 ) = 2 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 2 End If If Starfield( StarCount, 3 ) = 1 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 1 End If If Starfield( StarCount, 3 ) = 0 Then Starfield( StarCount, 2 ) = Starfield( StarCount, 2 ) + 1 End If If Starfield( StarCount, 2 ) > main_height-2 Then Starfield( StarCount, 0 ) = 0 ;WritePixelFast Starfield(StarCount,1),Starfield(StarCount,2)-main_height+300,star_color[starfield(starcount,3)] EndIf If starfield( starcount, 2 ) > main_height-300 Then If ReadPixelFast(Starfield( StarCount, 1 ), Starfield( StarCount, 2 )-main_height+301)<>gfx_bmaskc If ReadPixelFast(Starfield( StarCount, 1 )-1, Starfield( StarCount, 2 )-main_height+301)=gfx_bmaskc Starfield( StarCount, 1 ) = Starfield( StarCount, 1 ) - 1 ElseIf ReadPixelFast(Starfield( StarCount,1)+1,Starfield( StarCount, 2 )-main_height+301)=gfx_bmaskc Starfield( StarCount, 1 ) = Starfield( StarCount, 1 ) + 1 Else ;WritePixelFast Starfield(StarCount,1),Starfield(StarCount,2)-main_height+300,star_color[starfield(starcount,3)] Starfield( StarCount, 0 ) = 0 EndIf EndIf EndIf If Starfield( StarCount, 0 ) = 0 Then WritePixelFast Starfield(StarCount,1),Starfield(StarCount,2)-main_height+300,star_color[starfield(starcount,3)] Starfield( StarCount, 0 ) = 1 Starfield( StarCount, 1 ) = Rand( 0, main_width-1 ) Starfield( StarCount, 2 ) = 0 Starfield( StarCount, 3 ) = Rand( 0, 2 ) End If End If Next UnlockBuffer; ImageBuffer(gfx_boden) SetBuffer BackBuffer() End Function |
||
MrKeks.net |
walskiEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich glaube er meinte es halt auch noch so, dass die Pixel rutschen.
Und da wird dein Type Konzept recht unprakisch für sein. Also so, dass sich keine kleinen 100 Meter hohen Berge bilden sondern davon eben wieder die obersten Schichte nach unten rutschen ![]() ... Hm... is scheiße zu erklären ![]() walski |
||
buh! |
![]() |
bruZard |
![]() Antworten mit Zitat ![]() |
---|---|---|
walski hat Folgendes geschrieben: ... Hm... is scheiße zu erklären
Dann sage es doch per MMS ![]() |
||
PIV 2,4GHz - 1GB DDR 333 - ATI Radeon9600 - WinXP - DX9.0c - BMax 1.14 - B3D 1.91 - 1280x1024x32
User posted image |
konstantin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
lol, bruzard.
Sagst per Pain(t) ![]() |
||
![]() |
Mr.Keks |
![]() Antworten mit Zitat ![]() |
---|---|---|
höm? versteh dich auch nicht, walski. rutscht doch alles zur seite, wenn die seiten niedriger sind... und welches typekonzept? | ||
MrKeks.net |
walskiEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
O.k., vergiss es einfach wieder. Ich hab scheiße gelabert! Hab gar nicht gesehen dass es ja bei dir rutscht!
SORRY! ![]() walski |
||
buh! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group