RANDOMIZE TIMER
CLEAR ALL
BACKGROUND RGB(40,40,40)
BITMAP 1 LOAD "Floyd1.bmp"
BITMAP 2 LOAD "Floyd3.bmp"
BITMAP 3 LOAD "Floyd6.bmp"
SPRITE 1 BIND BITMAP 1 SHOW BORDER $FF00FFFF
SPRITE 2 BIND BITMAP 2 SHOW BORDER $FF00FFFF
SPRITE 3 BIND BITMAP 3 SHOW BORDER $FF00FFFF
SPRITE 2 MOVE RANGE(0,1280),RANGE(0,800) SCALE RND(1)+0.5,RND(1)+0.5 ROTATE RANGE(0,359)
SPRITE 3 MOVE RANGE(0,1280),RANGE(0,800) SCALE RND(1)+0.5,RND(1)+0.5 ROTATE RANGE(0,359)
PRINT "Use the arrow keys to move, W A S D to scale, Q E to rotate, Space to randomly place the Sprites, or Esc to quit."
PRINT
PRINT "Detect if sprites overlap, even if scaled or rotated."
PRINT
x=640:y=400
xs=1:ys=1
r=0
DO
    SPRITE 1 MOVE x,y SCALE xs,ys ROTATE r
    IF SPRITE.HIT(1,2)=1 OR SPRITE.HIT(1,3)=1 OR SPRITE.HIT(2,1) OR SPRITE.HIT(3,1) THEN
        BACKGROUND RGB(128,40,40)
    ELSE
        BACKGROUND RGB(40,40,40)
    END IF
    IF KEY.PRESSED(27) THEN EXIT DO
    IF KEY.PRESSED(VK_LEFT) THEN x=x-8
    IF KEY.PRESSED(VK_RIGHT) THEN x=x+8
    IF KEY.PRESSED(VK_UP) THEN y=y-8
    IF KEY.PRESSED(VK_DOWN) THEN y=y+8
    IF KEY.PRESSED(ASC("a")) THEN xs=xs-0.05
    IF KEY.PRESSED(ASC("d")) THEN xs=xs+0.05
    IF KEY.PRESSED(ASC("s")) THEN ys=ys-0.05
    IF KEY.PRESSED(ASC("w")) THEN ys=ys+0.05
    IF KEY.PRESSED(ASC("q")) THEN r=r-5:IF r<0 THEN r=r+360
    IF KEY.PRESSED(ASC("e")) THEN r=r+5:IF r>=360 THEN r=r-360
    IF KEY.PRESSED(32) THEN
        SPRITE 2 MOVE RANGE(0,1280),RANGE(0,800) SCALE RND(1)+0.5,RND(1)+0.5 ROTATE RANGE(0,359)
        SPRITE 3 MOVE RANGE(0,1280),RANGE(0,800) SCALE RND(1)+0.5,RND(1)+0.5 ROTATE RANGE(0,359)
    END IF
    PAUSE
LOOP
