Neverending loop
#3
Better?

Code: (Select All)
SCREEN _NEWIMAGE(1280, 720, 32)
$COLOR:32
f = _LOADFONT("courbd.ttf", 128, "monospace")
_FONT f
COLOR Red, Transparent
_PRINTSTRING (284, 200), "Steve is" '284 - 644
_PRINTSTRING (284, 328), "Mediocre!"
SLEEP
_FONT 8

Explode 284, 200, 644, 456, 16, 16


PRINT "FINISHED!!"






SUB Explode (x1, y1, x2, y2, pw, ph)
    tempScreen = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
    _PUTIMAGE , 0, tempScreen
    w = x2 - x1 + 1: h = y2 - y1 + 1
    ax = 2 * w \ pw + 1: ay = 2 * h \ ph + 1
    cx = x1 + w \ 2: cy = y1 + h \ 2

    TYPE box
        x AS SINGLE
        y AS SINGLE
        handle AS LONG
        rotation AS SINGLE
        changex AS SINGLE
        changey AS SINGLE
    END TYPE

    DIM Array(0 TO ax, 0 TO ay) AS box
    FOR x = 0 TO ax
        FOR y = 0 TO ay
            Array(x, y).handle = _NEWIMAGE(pw, ph, 32)
            Array(x, y).x = x1 + pw * x
            Array(x, y).y = y1 + ph * y
            _PUTIMAGE , 0, Array(x, y).handle, (x1 + pw * x, y1 + ph * y)-STEP(pw, ph)
            Array(x, y).changex = -(cx - Array(x, y).x) / 10
            Array(x, y).changey = -(cy - Array(x, y).y) / 10
        NEXT
    NEXT

    DO
        CLS , 0
        finished = -1
        FOR x = 0 TO ax
            FOR y = 0 TO ay
                Array(x, y).x = Array(x, y).x + Array(x, y).changex
                Array(x, y).y = Array(x, y).y + Array(x, y).changey
                IF Array(x, y).x >= 0 AND Array(x, y).y >= 0 AND Array(x, y).x <= _WIDTH / 4 AND Array(x, y).y <= _HEIGHT / 2 THEN finished = 0
                _PUTIMAGE (Array(x, y).x, Array(x, y).y)-STEP(pw, ph), Array(x, y).handle, 0, (0, 0)-(pw, ph)
            NEXT
        NEXT
        _DISPLAY
        _LIMIT 60

    LOOP UNTIL finished
    _AUTODISPLAY
END SUB
If eggs are brain food, Biden takes his scrambled.
Reply


Messages In This Thread
Neverending loop - by SMcNeill - 07-30-2022, 03:18 AM
RE: Neverending loop - by Pete - 07-30-2022, 03:42 AM
RE: Neverending loop - by Pete - 07-30-2022, 04:08 AM
RE: Neverending loop - by bplus - 07-30-2022, 05:02 AM
RE: Neverending loop - by TempodiBasic - 08-02-2022, 01:08 PM
RE: Neverending loop - by bplus - 07-30-2022, 05:11 AM
RE: Neverending loop - by Pete - 07-30-2022, 05:26 AM
RE: Neverending loop - by SMcNeill - 07-30-2022, 03:13 PM
RE: Neverending loop - by bplus - 07-30-2022, 03:43 PM
RE: Neverending loop - by Pete - 07-30-2022, 03:45 PM
RE: Neverending loop - by Kernelpanic - 07-30-2022, 09:54 PM
RE: Neverending loop - by bplus - 08-02-2022, 03:42 PM
RE: Neverending loop - by Kernelpanic - 08-02-2022, 05:03 PM
RE: Neverending loop - by admin - 08-02-2022, 06:59 PM
RE: Neverending loop - by Kernelpanic - 08-02-2022, 07:51 PM
RE: Neverending loop - by TempodiBasic - 08-04-2022, 12:43 AM



Users browsing this thread: 14 Guest(s)