### Author Topic: Quick Data Example[BB2D]  (Read 414 times)

0 Members and 1 Guest are viewing this topic.

#### Clyde

• A Little Fuzzy Wuzzy
• Posts: 7248
• Karma: 71
##### Quick Data Example[BB2D]
« on: January 17, 2007 »

Quick Data Example By Doctor
Originally Posted at Home Brew Forums.

Just a quick example of reading data in Blitz Basic:

Code: [Select]
` ;Data exampleGraphics 640,480,16,2SetBuffer BackBuffer()  Global blocks=10 ; amount of blocksDim x(blocks)   ; starting x position of each blockDim y(blocks)   ; starting y position of each blockDim r(blocks)   ; amount of red in each blockDim g(blocks)   ; amount of green in each blockDim b(blocks)   ; amount of blue in each blockFor a = 1 To blocks ; For every blockRead x(a)  ; read x posRead y(a)  ; read y posRead r(a)  ; read red amountRead g(a)  ; read green amountRead b(a)  ; read blue amountNextWhile Not KeyDown(1) ;repeat loop till escapeis pressedClsupdate_blocks()FlipWendFunction update_blocks()For a = 1 To blocks ; For every blockColor 255,0,0Color r(a),g(a),b(a)  ; set colour andRect x(a),y(a),50,50  ; draw blockNext End Function; here is the data. It is read as:; x position, y position, red value, green value, blue valueData 10,10,250,0,0Data 60,60,0,250,0Data 110,110,250,20,0Data 160,160,250,0,50Data 210,210,50,0,100Data 260,260,250,250,0Data 310,310,0,250,250Data 360,360,50,50,50Data 410,410,250,0,100Data 460,460,250,250,250`
« 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: