rem Types and functions: globals and functions - OpenDBC tutorial (DarkBASIC Professional) sync on : sync rate 60 autocam off color backdrop rgb(16, 18, 30) #constant BALLS 12 type Ball obj as integer x as float y as float speed as float endtype dim balls(BALLS) as Ball global bounces as integer for i = 1 to BALLS balls(i).obj = i balls(i).x = -55 + i * 9 balls(i).y = rnd(40) make object sphere i, 6 next i position camera 0, 25, -75 point camera 0, 15, 0 do for i = 1 to BALLS UpdateBall(i) next i text 10, 10, "Bounces: " + str$(bounces) sync loop function UpdateBall(i as integer) balls(i).speed = balls(i).speed - 0.15 balls(i).y = balls(i).y + balls(i).speed if balls(i).y < 0 balls(i).y = 0 balls(i).speed = 4.0 inc bounces endif position object balls(i).obj, balls(i).x, balls(i).y, 0 endfunction