Planet View
#17
Oh here as an older one, move mouse and change "tunnels" on this crazy satellite:
Code: (Select All)
_Title "Move your mouse" + Space$(53) + "Satellite" 'B+ post 2019-01-10

Const xmax = 600
Const ymax = 600
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 300, 60
map& = _NewImage(xmax, ymax, 32)
'stars& = _LoadImage("stars.png")
r = ymax / 2.5: xc = xmax / 2: yc = ymax / 2: xo = 0
_MouseHide

While _KeyHit <> 27
    While _MouseInput: Wend
    mx = _MouseX / xmax: my = _MouseY / ymax
    _Dest map&
    Color , _RGB32(68, 68, 68): Cls
    For y = 0 To ymax Step 100
        For x = 0 To xmax Step 100
            tct x + 3, y + 3, 94, 94, mx, my
        Next
    Next
    '_PutImage , stars&, 0
    For y = -r To r
        x1 = Sqr(r * r - y * y)
        tv = (_Asin(y / r) + 1.5) / 3
        For x = -x1 + 1 To x1
            tu = (_Asin(x / x1) + 1.5) / 6
            _Source map&
            pc~& = Point((xo + tu * xmax) Mod xmax, tv * ymax)
            _Dest 0
            PSet (x + xc, y + yc), pc~&
        Next x
    Next y
    xo = xo - 1 + xmax
    xo = xo Mod xmax
    _Display
    _Limit 10
Wend

Sub tct (x, y, w, h, fx, fy)
    mx = fx * w
    my = fy * h
    dlx = (mx - 1) / 10: drx = (w - mx - 1) / 10: dty = (my - 1) / 10: dby = (h - my - 1) / 10
    tx = 0: ty = 0
    For i = 10 To 1 Step -1
        Line (x + mx - i * dlx, y + my - i * dty)-(x + mx + i * drx, y + my + i * dby), _RGB32(5 * i, 10 * i, 15 * i), BF
    Next
    Color _RGBA32(155, 140, 40, 120)
    xx = x + w - mx: yy = y + h - my
    PSet (xx, yy)
    tx = 0: ty = 0
    While tx < w - drx - dlx
        tx = tx + drx
        Line -Step(-tx, 0)
        ty = ty + dby
        Line -Step(0, -ty)
        tx = tx + dlx
        Line -Step(tx, 0)
        ty = ty + dty
        Line -Step(0, ty)
    Wend
    Lightning x + mx, y + my, xx, yy, h
End Sub

Sub Lightning (x1, y1, x2, y2, d)
    If d < 5 Then
        Color _RGB(225, 225, 245)
        Line (x1, y1)-(x2, y2)
    Else
        mx = (x2 + x1) / 2
        my = (y2 + y1) / 2
        mx = mx + -.5 * Rnd * d * .4 * rand&&(-2, 2)
        my = my + -.5 * Rnd * d * .4 * rand&&(-2, 2)
        Lightning x1, y1, mx, my, d / 2
        Lightning x2, y2, mx, my, d / 2
    End If
End Sub

Function rand&& (lo&&, hi&&)
    rand&& = Int(Rnd * (hi&& - lo&& + 1)) + lo&&
End Function

   
b = b + ...
Reply


Messages In This Thread
Planet View - by James D Jarvis - 09-05-2022, 07:37 PM
RE: Planet View - by SierraKen - 09-05-2022, 07:58 PM
RE: Planet View - by James D Jarvis - 09-06-2022, 12:05 AM
RE: Planet View - by OldMoses - 09-06-2022, 12:12 AM
RE: Planet View - by mnrvovrfc - 09-06-2022, 12:32 AM
RE: Planet View - by James D Jarvis - 09-06-2022, 01:17 PM
RE: Planet View - by johnno56 - 09-06-2022, 08:20 PM
RE: Planet View - by Kernelpanic - 09-08-2022, 10:57 PM
RE: Planet View - by 40wattstudio - 09-10-2022, 02:01 PM
RE: Planet View - by bplus - 09-10-2022, 05:16 PM
RE: Planet View - by bplus - 09-10-2022, 05:41 PM
RE: Planet View - by dbox - 09-10-2022, 07:28 PM
RE: Planet View - by dbox - 09-11-2022, 03:45 AM
RE: Planet View - by bplus - 09-11-2022, 03:10 PM
RE: Planet View - by James D Jarvis - 09-12-2022, 01:44 PM
RE: Planet View - by bplus - 09-12-2022, 03:57 PM
RE: Planet View - by bplus - 09-12-2022, 04:03 PM
RE: Planet View - by James D Jarvis - 09-13-2022, 05:06 PM



Users browsing this thread: 2 Guest(s)