|
Rain
Dec 28, 2019 0:47:16 GMT -6
Post by johnno56 on Dec 28, 2019 0:47:16 GMT -6
This is a - not sure how to classify it - a simple "rain" animation / simulation. This is NOT my work. Originally coded by Marc Gale 2014. Found in an old folder in sdlbasic and thought, "Why not?" Had a few minutes between coffees and cobbled together an RC version... I will not be offended if you choose not to use it... Just a bit of idle fun... xmax = 640 ymax = 512 title$ = "RAIN by Marc Gale"
WindowOpen(1,title$,0,0,xmax,ymax,0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
loadMusic("rain.ogg")
md = 10
Dim dropX[md] Dim dropY[md] Dim dropR[md]
for a = 1 to md dropX[a] = rand(640) dropY[a] = rand(512) dropR[a] = rand(40) next
playMusic(-1)
do ClearCanvas setColor(rgb(0,0,50)) RectFill(0,0,640,512) for a = 1 to md bri = 250 - dropR[a] * 5 setColor(rgb(0,0,bri)) circle(dropX[a], dropY[a], dropR[a]) dropR[a] = dropR[a] + 1 if dropR[a] > 40 then dropX[a] = rand(640) dropY[a] = rand(512) dropR[a] = 0 end if next update wait(20) loop until key(k_escape) = 1 stopMusic wait(1000) end Attachments:rain.ogg (240.95 KB)
|
|
|
Rain
Dec 30, 2019 10:31:11 GMT -6
Post by tbird on Dec 30, 2019 10:31:11 GMT -6
Neat johnno56, this would work good for a birds eye/top down game. You could make rain drops or "lines" then pass there random contact point the origin point for the rain circle.
|
|
|
Rain
Dec 30, 2019 13:25:54 GMT -6
Post by n00b on Dec 30, 2019 13:25:54 GMT -6
This is a pretty cool demo.
|
|