Regen
Verfasst: 11.12.2008 09:08
Welche Moeglichkeiten gibt es, Regen moeglichst realistisch (durchsichtig) in einem 2D-JumpnRun darzustellen?
Hat jemand Tipps?
Hat jemand Tipps?
Code: Alles auswählen
InitSprite()
xP = 800
yP = 600
xP2 = xP/2
yP2 = yP/2
OpenWindow(0, 0, 0, xP, yP, "SCREEN", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, xP, yP, 0, 0, 0)
CreateSprite(1, 20, 20)
StartDrawing(SpriteOutput(1))
Line(0,0,2,6,$504040)
Line(2,6,2,6,$807070)
Line(4,12,2,6,$B0A0A0)
Line(3,12,2,6,$807070)
StopDrawing()
CreateSprite(2, 20, 20)
StartDrawing(SpriteOutput(2))
Line(6,18,-5,-8,$A08080)
Line(6,18,-2,-10,$A08080)
Line(6,18,1,-12,$A08080)
Line(6,18,3,-7,$A08080)
StopDrawing()
Structure Tropfen
x.f
y.f
v.f
EndStructure
NewList Tropfen.Tropfen()
Repeat
Event = WindowEvent()
ClearScreen(0)
For n = 1 To 3
AddElement(Tropfen())
Tropfen()\x = Random(xP2*3)-xP2
Tropfen()\y = -32
Tropfen()\v = Random(5)/10+2
Next
ForEach Tropfen() : With Tropfen()
\x + 1*\v
\y + 3*\v
If \y > 582 :
DisplayTransparentSprite(2, \x, 582)
\x - 1*\v
EndIf
DisplayTransparentSprite(1, \x, \y)
If \y > 600 : DeleteElement(Tropfen()) : EndIf
EndWith : Next
FlipBuffers()
Until Event = #PB_Event_CloseWindow
Code: Alles auswählen
InitSprite()
InitSprite3D()
xP = 800
yP = 500
xP2 = xP/2
yP2 = yP/2
OpenWindow(0, 0, 0, xP, yP, "SCREEN", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, xP, yP, 0, 0, 0)
CreateSprite(1, 20, 20)
StartDrawing(SpriteOutput(1))
Line(0,0,2,6,$504040)
Line(2,6,2,6,$807070)
Line(4,12,2,6,$B0A0A0)
Line(3,12,2,6,$807070)
StopDrawing()
CreateSprite(2, 20, 20)
StartDrawing(SpriteOutput(2))
Line(6,18,-5,-8,$A08080)
Line(6,18,-2,-10,$A08080)
Line(6,18,1,-12,$A08080)
Line(6,18,3,-7,$A08080)
StopDrawing()
Structure Tropfen
x.f
y.f
v.f
EndStructure
NewList Tropfen.Tropfen()
Repeat
Event = WindowEvent()
ClearScreen(0)
For n = 1 To 3
AddElement(Tropfen())
Tropfen()\x = Random(xP2*3)-xP2
Tropfen()\y = -32
Tropfen()\v = Random(5)/10+2
Next
ForEach Tropfen() : With Tropfen()
\x + 1*\v
\y + 3*\v
If \y > yP - 18 :
DisplayTransparentSprite(2, \x, yP-18)
\x - 1*\v
EndIf
DisplayTransparentSprite(1, \x, \y)
If \y > yP : DeleteElement(Tropfen()) : EndIf
EndWith : Next
FlipBuffers()
Until Event = #PB_Event_CloseWindow