CLEAR ALL
PRINT
PRINT "Press any key to see the next Bezier curve, or ESC to quit. Click on the nodes to change the Bezier curve."
BITMAP 1 NEW 20,20
TARGET BITMAP 1
'rect fill 0,0,19,19
CIRCLE FILL 10,10,9
SPRITE 1 BIND BITMAP 1 SHOW XYSTEP 2,2 TINT RGB(255,0,0)    ' red
SPRITE 2 BIND BITMAP 1 SHOW XYSTEP 2,2 TINT RGB(0,255,0)    ' green
SPRITE 3 BIND BITMAP 1 SHOW XYSTEP 2,2 TINT RGB(255,255,0)    ' yellow
SPRITE 4 BIND BITMAP 1 SHOW XYSTEP 2,2 TINT RGB(0,0,255)    ' blue
SCREEN 5
DIM x(4),y(4)
DO
    FOR i=1 TO 4
        x(i)=RANGE(0,639):y(i)=RANGE(0,399)
    NEXT i
    GOSUB redraw
    FOR i=1 TO 4
        SPRITE i MOVE x(i),y(i)
    NEXT i
    DO
        FOR i=1 TO 4
            IF SPRITE.CLICKED(i) THEN
                x(i)=MOUSE.X/2:y(i)=MOUSE.Y/2
                GOSUB redraw
                SPRITE i MOVE x(i),y(i)
                EXIT FOR
            END IF
        NEXT i
        PAUSE
        a$=INKEY$
    LOOP WHILE a$=""
LOOP UNTIL a$=CHR$(27)
END

redraw:
CLEAR BITMAP
BEZIER CURVE x(1),y(1),x(2),y(2),x(3),y(3),x(4),y(4)
RETURN
