Rain
#1
Here is a little diversionary program written by Marc Gale for yabsic. I converted it to sdlbasic and figured, "Why not?", for QB64.

J


Attached Files .zip   rain.zip (Size: 1.47 MB / Downloads: 12)
May your journey be free of incident.

Live long and prosper.
Reply
#2
Hi Johnno,

I remember this little beauty at BP.org from Galileo and then at SdlBasic from you? 

But your .zip package must have been mutated by gamma rays. I can't get the.wav file to work though it works fine through my Windows Player 

and something is funny about that rain, here is my copy:
Code:
'rem rain - a simple raindrop effect
'rem copyright Marc Gale (Xalthorn)
'rem Adapted by Galileo, 2014/9
'rem gamma rays ruined rain 2017/10

SCREEN _NEWIMAGE(640, 512, 32)
_TITLE ("RAIN ruin, press esc ")
COMMON SHARED x(), y(), r(), v(), g()
md = 100: DIM x(md): DIM y(md): DIM r(md): DIM v(md): DIM g(md)
drops = 1: newdrop 1
WHILE INKEY$ <> CHR$(27)
    CLS
    LINE (0, 0)-(640, 512), _RGB32(0, 0, 50), BF
    FOR a = 1 TO drops
        COLOR _RGBA(30, 30, 250 - r(a) * 5, 205 - r(a) * 5)
        rain x(a), y(a), r(a), v(a), g(a)
        r(a) = r(a) + 1
        IF g(a) < 0 THEN g(a) = g(a) - _PI(1 / 60) ELSE g(a) = g(a) + _PI(1 / 60)
        IF r(a) > 40 THEN newdrop a
    NEXT
    _DISPLAY
    _LIMIT 30
    IF drops < md THEN drops = drops + 1: newdrop drops
WEND
SUB rain (x, y, r, n, o)
    a = _PI(2) / n: x1 = x + r * COS(a + o): y1 = y + r * SIN(a + o)
    FOR i = 2 TO n + 1
        x2 = x + r * COS(i * a + o): y2 = y + r * SIN(i * a + o)
        LINE (x1, y1)-(x2, y2): x1 = x2: y1 = y2
    NEXT
END SUB
SUB newdrop (a)
    x(a) = RND * 640: y(a) = RND * 512: r(a) = 1
    v(a) = INT(RND * 4) + 3: IF RND < .5 THEN rd = -1 ELSE rd = 1
    g(a) = RND * _PI(2) * rd
END SUB
B += x
Reply
#3
Cool crystallized rain...

Strange about the sound file. Grabbed it directly from soundbible.com. No edits or mods. Used it in sdlbasic and qb64 before packing it.

Yeah. This demo's 'been around the block' a few times. I do not recall it being on this site... I've always thought it was pretty cool... My sdlbasic version included a bit of distant thunder... as I said before, just a diversion....

J
May your journey be free of incident.

Live long and prosper.
Reply
#4
@Johnno56

I love rain demos! Well... I love all kinds of graphical demos, but rain ones are one of them.

When I finish touching up a game engine for David Taylor, and a powerful C++ include file for QB64 (which I will post only here on this forum for others to use), I think I would like to create a rain demo myself for fun.

Nice technique Johnno56. Thanks for sharing.
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#5
Thank you. But the the work is not mine. It's just a demo that I converted to qb64...

J
May your journey be free of incident.

Live long and prosper.
Reply