Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lightning Globe
#5
I remember us playing with globes back in the ancient times. Here is mine: 

Code: (Select All)

'This program was made on Sept. 5, 2019 by SierraKen
'Thank you to B+ and Steve from the QB64 forum for the inspiration and some help.
_Title "Lightning Globe by SierraKen - Use Mouse and Left Mouse Button On the Globe. Esc to end."
_ScreenMove 400, 60
Screen _NewImage(800, 600, 32)
x = 400
y = 300
c = 1
st = 2
go:
a$ = InKey$
If a$ = Chr$(27) Then End
_Limit 1000
Line (400, 300)-(150, 600), _RGB32(50, 50, 50)
Line (400, 300)-(650, 600), _RGB32(50, 50, 50)
Line (150, 600)-(650, 600), _RGB32(50, 50, 50)
Paint (500, 580), _RGB32(50, 50, 50)

For sz = 1 To 200 Step .25
    c = c + .05 + r
    Circle (x, y), sz, _RGB32(c, c / 2, c)
Next sz
c = 0
For sz = 1 To 30 Step .25
    c = c + .005
    Circle (x, y), sz, _RGB32(c, c, c)
Next sz

While _MouseInput: Wend
handx = _MouseX: handy = _MouseY: MB = _MouseButton(1)

If l > 500 Then l = 500
If l < 50 Then l = 50

If MB = -1 And _Hypot(handx - 400, handy - 300) < 200 Then
    r = .1
    Randomize Timer
    lxx = (Rnd * 60) + 370
    lyy = (Rnd * 60) + 270
    Randomize Timer
    lxxx = (Rnd * 60) + 370
    lyyy = (Rnd * 60) + 270
    bolts = Int(Rnd * 100) + 1
    Circle (lxx, lyy), 4, _RGB32(255, 245, 255)
    Paint (lxx, lyy), _RGB32(255, 245, 255)
    If bolts > 50 Then
        Circle (lxxx, lyyy), 4, _RGB32(255, 245, 255)
        Paint (lxxx, lyyy), _RGB32(255, 245, 255)
    End If

    Do
        _Limit 1000
        oldlx = lxx
        oldly = lyy
        oldlxx = lxxx
        oldlyy = lyyy
        If lxx < handx Then dxx = 10
        If lxx > handx Then dxx = -10
        If lyy < handy Then dyy = 10
        If lyy > handy Then dyy = -10
        If lxxx < handx Then dxxx = 10
        If lxxx > handx Then dxxx = -10
        If lyyy < handy Then dyyy = 10
        If lyyy > handy Then dyyy = -10
        Randomize Timer
        dx = (Rnd * 8) - 4
        dy = (Rnd * 8) - 4
        Randomize Timer
        dxxxx = (Rnd * 8) - 4
        dyyyy = (Rnd * 8) - 4
        lxx = lxx + dx
        lyy = lyy + dy
        lxx = lxx + dxx
        lyy = lyy + dyy
        lxxx = lxxx + dxxxx
        lyyy = lyyy + dyyyy
        lxxx = lxxx + dxxx
        lyyy = lyyy + dyyy
        Line (oldlx, oldly)-(lxx, lyy), _RGB32(255, 230, 255)
        If bolts > 50 Then Line (oldlxx, oldlyy)-(lxxx, lyyy), _RGB32(255, 230, 255)
        ttt = ttt + 1
        If ttt > 20 Then
            Circle (lxx, lyy), 10, _RGB32(255, 245, 255)
            Paint (lxx, lyy), _RGB32(255, 245, 255)
            GoTo nex:
        End If
    Loop
End If
r = 0
nex:
ttt = 0
Randomize Timer
lxx2 = (Rnd * 60) + 370
lyy2 = (Rnd * 60) + 270
Randomize Timer
lxx3 = (Rnd * 200) + 270
lyy3 = (Rnd * 200) + 170
Randomize Timer
lxx4 = (Rnd * 60) + 370
lyy4 = (Rnd * 60) + 270
Randomize Timer
lxx5 = (Rnd * 200) + 270
lyy5 = (Rnd * 200) + 170

Circle (lxx2, lyy2), 4, _RGB32(255, 245, 255)
Paint (lxx2, lyy2), _RGB32(255, 245, 255)
Circle (lxx4, lyy4), 4, _RGB32(255, 245, 255)
Paint (lxx4, lyy4), _RGB32(255, 245, 255)

Do
    _Limit 1000
    oldlx2 = lxx2
    oldly2 = lyy2
    oldlx4 = lxx4
    oldly4 = lyy4
    If lxx2 < lxx3 Then dxx = 10
    If lxx2 > lxx3 Then dxx = -10
    If lyy2 < lyy3 Then dyy = 10
    If lyy2 > lyy3 Then dyy = -10

    If lxx4 < lxx5 Then dxx2 = 10
    If lxx4 > lxx5 Then dxx2 = -10
    If lyy4 < lyy5 Then dyy2 = 10
    If lyy4 > lyy5 Then dyy2 = -10
    Randomize Timer
    dx = (Rnd * 8) - 4
    dy = (Rnd * 8) - 4
    Randomize Timer
    dx2 = (Rnd * 8) - 4
    dy2 = (Rnd * 8) - 4
    lxx2 = lxx2 + dx
    lyy2 = lyy2 + dy
    lxx2 = lxx2 + dxx
    lyy2 = lyy2 + dyy
    lxx4 = lxx4 + dx2
    lyy4 = lyy4 + dy2
    lxx4 = lxx4 + dxx2
    lyy4 = lyy4 + dyy2
    Line (oldlx2, oldly2)-(lxx2, lyy2), _RGB32(255, 161, 255)
    Line (oldlx4, oldly4)-(lxx4, lyy4), _RGB32(255, 161, 255)
    ttt2 = ttt2 + 1
    If ttt2 > 50 Then
        Circle (lxx2, lyy2), 8, _RGB32(255, 230, 255)
        Paint (lxx2, lyy2), _RGB32(255, 230, 255)
        Circle (lxx4, lyy4), 8, _RGB32(255, 230, 255)
        Paint (lxx4, lyy4), _RGB32(255, 230, 255)
        GoTo nex2:
    End If
Loop

nex2:
Line (0, 0)-(_Width, _Height), _RGB32(0, 0, 0, 30), BF
ttt2 = 0
_Display
GoTo go:
'Going back to the start of Main 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)