_TITLE "Astera" 'b+ mod 2020-09-12 ' TdB mod 2020-09-14 CONST nRocks
= 5 '<--- better less meteors
_DELAY .25 'allow screen to load
' filter out dark space
new i
'FOR y = 0 TO _HEIGHT
' FOR x = 0 TO _WIDTH
' r = RND * 55
' LINE (x, y)-STEP(0, 0), _RGB32(r, r, r, RND * 50 + 150)
' NEXT
'NEXT
r(i).dx = r(i).dx * .80 '<--- we reduce acceleration X as far is the meteor
r(i).dy = r(i).dy * .80 '<--- we reduce acceleration Y as far is the meteor
r(i).X = r(i).X + r(i).dx
r(i).Y = r(i).Y + r(i).dy
r(i).Z = r(i).Z - .2 ' <--- we go away from camera/point of view of user
' |
' V and we must regenerate the meteor if it is too far from our point of view
QSort 0, nRocks
r(i).Z = 50 '<--- our meteor is next to our point of view
r
(i
).dx
= d
/ 100 * COS(angle
) r
(i
).dy
= d
/ 100 * SIN(angle
)
SUB QSort
(Start
, Finish
) 'sa$ needs to be DIM SHARED !!!! array i = Start
j = Finish
x
= r
(INT((i
+ j
) / 2)).Z
i = i + 1
j = j - 1
i = i + 1
j = j - 1
IF j
> Start
THEN QSort Start
, j
IF i
< Finish
THEN QSort i
, Finish