CLEAR ALL
BACKGROUND RGB(10,40,120)

' initialization

w=WINDOW.WIDTH:h=WINDOW.HEIGHT
BITMAP 1 LOAD SHEET "Sheet.xml" STRIP ".png"
FOR i=0 TO 42
    n$=USING$("###",i):n$=STRREPLACE$(n$," ","0")
    BITMAP i+2 LOAD "run_"+n$+".png"
NEXT i

SPRITE 1 BIND BITMAP 1 SELECT "Sun" SHOW MOVE 100,100 TINT RGB(255,255,0)
FOR i=2 TO 9
    SPRITE i BIND BITMAP 1 SELECT "Cloud"+STR$(RANGE(1,9)) SHOW MOVE RANGE(0,w),RANGE(0,h/4) TINT RGB(255,255,255,RANGE(225,255))
NEXT i
SPRITE 10 BIND BITMAP 1 SELECT "Hills1" SHOW MOVE w/2,h/2-50 XYSIZE 1.5,1.5 TINT RGB(20,250,60)
SPRITE 11 BIND BITMAP 2 SHOW
SPRITE 12 BIND BITMAP 1 SELECT "Tree05" SHOW MOVE w+200,h/2

SCREEN BITMAP 320,240 STRETCH
INK RGB(10,200,30)
RECT FILL 0,120,319,239

' main loop

d=1
n=2
DO
    IF d=1 THEN
        FOR i=2 TO 9
            SPRITE i MOVE RELATIVE -i/2,0
            IF SPRITE.X(i)<-200 THEN SPRITE i MOVE w+200,RANGE(0,h/4)
        NEXT i
        SPRITE 12 MOVE RELATIVE -5,0
        IF SPRITE.X(12)<-200 THEN SPRITE 12 MOVE w+200,h/2
    ELSE
        FOR i=2 TO 9
            SPRITE i MOVE RELATIVE i/2,0
            IF SPRITE.X(i)>w+200 THEN SPRITE i MOVE -200,RANGE(0,h/4)
        NEXT i
        SPRITE 12 MOVE RELATIVE 5,0
        IF SPRITE.X(12)>w+200 THEN SPRITE 12 MOVE -200,h/2
    END IF
    SPRITE 11 BIND BITMAP n
    n=n+1
    IF n=44 THEN n=2
    PAUSE
    a$=INKEY$
    IF a$=" " THEN d=1-d:SPRITE 11 MIRROR 1-d:a$=""
LOOP WHILE a$=""
