_TITLE "Drawlandscape Parallax test" 'started 2019-03-27 'test if can get end of landscape level to start for big looping background
'2019-03-27 a more gentle adjustment back to Mountain starting height for
'more seamless connect of back end to front
'2019-03-27 start this file with parallax drawing test
rate
AS SINGLE 'number of pixels per frame added to le (leading edge)nLevels = 6
LoadLandscape
scapeWidth
= _WIDTH(para
(1).handle
)scapeHeight
= _HEIGHT(para
(1).handle
)
IF para
(i
).le
+ 800 > scapeWidth
THEN te = scapeWidth - para(i).le
_PUTIMAGE (0, 0)-(te
, scapeHeight
), para
(i
).handle
, 0, (scapeWidth
- te
, 0)-(scapeWidth
, scapeHeight
) _PUTIMAGE (te
, 0)-(800, scapeHeight
), para
(i
).handle
, 0, (0, 0)-(800 - te
, scapeHeight
)
_PUTIMAGE (0, 0)-(800, scapeHeight
), para
(i
).handle
, 0, (para
(i
).le
, 0)-(para
(i
).le
+ 800, scapeHeight
)
para(i).le = para(i).le - para(i).rate
IF para
(i
).le
< 0 THEN para
(i
).le
= scapeWidth
t = t + 1
xmax = 800 * 3.25: ymax = 600
hdl& = 1
para
(hdl&
).handle
= _NEWIMAGE(xmax
, ymax
, 32)
midInk 0, 0, 128, 128, 128, 200, i / ymax
'the land
startH = ymax - 200
rr = 70: gg = 70: bb = 90
FOR mountain
= 1 TO nLevels
para
(mountain
).handle
= _NEWIMAGE(xmax
, ymax
, 32) _DEST para
(mountain
).handle
Xright = 0
y = startH
' upDown = local up / down over range, change along Y
' range = how far up / down, along X
upDown
= (RND * .8 - .4) * (mountain
* .5) range = Xright + rand%(15, 25) * 2.5 / mountain
IF range
> xmax
- 50 THEN range
= xmax
- 50 lastx = Xright - 1
FOR x
= Xright
TO range
'need less flat tops test = y + upDown
test2 = y - upDown
IF ABS(test
- startH
) < .13 * startH
THEN y
= test
ELSE y
= test2: upDown
= -upDown
LINE (lastx
, y
)-(x
, ymax
), , BF
'just lines weren't filling right lastx = x
Xright = range
x = lastx + 1
dy = (startH - y) / 50 'more gentle adjustment back to start of screen
y = y + dy
LINE (lastx
, y
)-(x
, ymax
), , BF
'just lines weren't filling right lastx = x
x = x + 1
rr = rand%(rr - 15, rr): gg = rand%(gg - 15, gg): bb = rand%(bb - 25, bb)
startH = startH + mountain * rand%(2, 10)
para(mountain).le = xmax - 800
para(mountain).rate = mountain * .5
rand%
= INT(RND * (hi%
- lo%
+ 1)) + lo%
SUB midInk
(r1%
, g1%
, b1%
, r2%
, g2%
, b2%
, fr##
) COLOR _RGB(r1%
+ (r2%
- r1%
) * fr##
, g1%
+ (g2%
- g1%
) * fr##
, b1%
+ (b2%
- b1%
) * fr##
)