Author Topic: Tunnel coil 3 with transcender :)  (Read 1923 times)

B+

  • Guest
Tunnel coil 3 with transcender :)
« on: January 08, 2019, 04:15:10 PM »
Code: [Select]
_TITLE "tunnel coil 3 with transcender" ' B+ 2019-01-08
CONST xmax = 800
CONST ymax = 600
SCREEN _NEWIMAGE(xmax, ymax, 32)
_MOUSEHIDE
WHILE _KEYHIT <> 27
    CLS
    WHILE _MOUSEINPUT: WEND
    mx = _MOUSEX: my = _MOUSEY
    dlx = (mx - 1) / 50: drx = (xmax - mx - 1) / 50: dty = (my - 1) / 50: dby = (ymax - my - 1) / 50
    x = mx: y = my
    tx = 0: ty = 0 '<<<<<<<<<<<<<<<< need this to work???
    FOR i = 50 TO 1 STEP -1
        LINE (mx - i * dlx, my - i * dty)-(mx + i * drx, my + i * dby), _RGB32(2 * i, 3 * i, 4 * i), BF
    NEXT
    COLOR _RGBA32(255, 140, 140, 120)
    x = xmax - mx: y = ymax - my
    PSET (x, y)
    tx = 0: ty = 0
    WHILE ty < ymax
        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 mx, my, xmax - mx, ymax - my, ymax
    _DISPLAY
    _LIMIT 60
WEND

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


Snap only catches one transcender, when watching the run there are several!

Aurel

  • Guest
Re: Tunnel coil 3 with transcender :)
« Reply #1 on: January 08, 2019, 04:18:46 PM »
Which basic is this?
qb64 or  SB ?

B+

  • Guest
Re: Tunnel coil 3 with transcender :)
« Reply #2 on: January 08, 2019, 04:24:36 PM »
QB64 x 64