Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lightning Globe
#1
Since everyone is playing around with balls, globes, coins, circles and tigers and bears -- Oh my!!  I decided to share this old Lightning Globe that I'd wrote sometime back in the stone ages of QB64.   Maybe Dav, or someone skilled with the SOUND command will go in and add a nice little zappy zappy sizzle for us.

Just click on the screen and watch the lightning globe make lightning!

Code: (Select All)
Screen _NewImage(640, 480, 32)
Dim Kolor As _Unsigned Long
Const LevelOfVariance = 5 'Change this value to have fun with the strength of the "draw" to target.
Do
_Limit 60
Cls
Circle (320, 240), 20, &HFFAAAAAA
Paint (320, 240), &HFFAAAAAA
While _MouseInput: Wend
If _MouseButton(1) Then
StartX = 320: StartY = 240: EndX = _MouseX: EndY = _MouseY
Kolor = &HFF000000 + Int(Rnd * &H1000000)
Color Kolor
Do Until StartX = EndX And StartY = EndY
CoinToss = Rnd * 100 'The strength of "draw" which pulls the lightning to the target.
If CoinToss < LevelOfVariance Then 'Higher values meander less and go directly to the target.
XChange = Sgn(EndX - StartX) '-1,0,1, drawn always towards the mouse
YChange = Sgn(EndY - StartY)
Else
XChange = Int(Rnd * 3) - 1 '-1, 0, or 1, drawn in a random direction to let the lightning wander
YChange = Int(Rnd * 3) - 1
End If
StartX = StartX + XChange
StartY = StartY + YChange
PSet (StartX, StartY), Kolor
Loop
End If
_Display
Loop
Reply


Messages In This Thread
Lightning Globe - by SMcNeill - 09-11-2024, 01:36 AM
RE: Lightning Globe - by Pete - 09-11-2024, 06:36 AM
RE: Lightning Globe - by DANILIN - 09-11-2024, 04:46 PM
RE: Lightning Globe - by NakedApe - 09-11-2024, 06:36 PM
RE: Lightning Globe - by SierraKen - 09-16-2024, 04:49 AM



Users browsing this thread: 2 Guest(s)