Author Topic: Quick Arrays Example[BB2D]  (Read 430 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7245
  • Karma: 71
    • View Profile
Quick Arrays Example[BB2D]
« on: January 17, 2007 »


Quick Arrays Example By Doctor
Originally Posted at the Home Brew Forums.


Just a quick example showing arrays in Blitz Basic:

Code: [Select]
;
; Arrays example
;
Graphics 640,480
SetBuffer BackBuffer()
Global stars=100
Dim x(stars)
Dim y(stars)
Dim s(stars)

For a = 1 To stars
x(a)=Rand(640)
y(a)=Rand(480)
s(a)=Rand(5)
Next

While Not KeyDown(1)
Cls
update_stars()
Flip
Wend

Function update_stars()
For a = 1 To stars
Rect x(a),y(a),3,3
x(a)=x(a)+s(a)
If x(a)>640 Then
x(a)=0
EndIf
Next
End Function
« Last Edit: July 21, 2007 by Shockwave »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: