September 28, 2021, 05:47:00

### Author Topic: Particle Fountain  (Read 678 times)

#### bplus

• Full Member
• Posts: 221
##### Particle Fountain
« on: March 25, 2021, 01:37:57 »
What could be simpler?

Code: [Select]
`' b+ 2021-03-24 translate QB64 _Title "Particle Fountain" 'b+ 2020-08-27Const nP = 30000Dim p(1 To nP)For i = 1 To nP    new iNextColor 15, RGB(0,34,0)Repeat    Cls    If lp < nP Then lp = lp + 10    For i = 1 To lp        p(i).dy = p(i).dy + .1        p(i).x = p(i).x + p(i).dx        p(i).y = p(i).y + p(i).dy        If p(i).x < .2 * Xmax Or p(i).x > .8 * Xmax Then new i        If p(i).y > Ymax And p(i).dy > 0 Then            p(i).dy = -.75 * p(i).dy: p(i).y = Ymax - 5        End If        Circle p(i).x, p(i).y, p(i).r, 1, p(i).c    Next    ShowpageUntil Asc(Inkey) = 27Sub new (i)    p(i).x = Xmax / 2 + Rnd * 20 - 10    p(i).y = Ymax + Rnd * 5    p(i).dx = Rnd - .5    p(i).dy = -10    p(i).r = Rnd * 4    p(i).c = RGB(100 * Rnd + 115, 100 * Rnd + 115, Rnd * 100 + 155)End Sub`

#### johnno56

• Jr. Member
• Posts: 49
• Logic is the beginning of Wisdom.
##### Re: Particle Fountain
« Reply #1 on: March 31, 2021, 20:24:12 »
Who doesn't love a good particle fountain? Yet another job nicely done...
May your journey be free of incident.

Live long and prosper.

#### lettersquash

• Jr. Member
• Posts: 96
##### Re: Particle Fountain
« Reply #2 on: May 05, 2021, 21:05:24 »
Nice one, Bplus!

I haven't written much sB for a while. I read:
Code: [Select]
`For i = 1 To nP    new iNext`and spent ten minutes trying to find "new" in the docs, thinking this was some clever self-expanding i.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

#### bplus

• Full Member
• Posts: 221
##### Re: Particle Fountain
« Reply #3 on: May 06, 2021, 17:19:01 »
LOL well looks like someone is getting rusty...

It's fun to share code more on my level, ie no experience with C stuff interacting with sb.

I wonder if chris has it so we can draw on top of images yet, with alpha (RGBA) would be even better?

This little proggie works pretty darn good for an Interpreter!

#### johnno56

• Jr. Member
• Posts: 49
• Logic is the beginning of Wisdom.
##### Re: Particle Fountain
« Reply #4 on: June 29, 2021, 21:25:14 »
"What could be simpler?"

Challenge accepted.  Change line #2 to 'const nP = 10'

Do I get a prize? Huh. Do I?

J

ps: .... and not a mention of blue
May your journey be free of incident.

Live long and prosper.