home *** CD-ROM | disk | FTP | other *** search
/ Game Programming for Teens / GameProgrammingForTeens.iso / Source / chapter03 / demo03-10.bb < prev    next >
Encoding:
Text File  |  2004-08-28  |  718 b   |  35 lines

  1. ;demo03-10.bb - Draws out 25 '*'s and 25 '+'s
  2.  
  3. ;create the array
  4. Dim starsplusses$(2,25) 
  5.  
  6. ;initialize the array. The first dimension will contain *'s and the second will contain +'s
  7. For rows = 0 To 1 
  8.     For columns=0 To 24
  9.         ;Assign either + or *, depending on the return value of FindChar$()
  10.         starsplusses$(rows,columns) = FindChar$(rows)
  11.     Next
  12.     
  13. Next
  14.  
  15. ;display the array
  16. For rows = 0 To 1 
  17.     For columns = 0 To 24
  18.         ;Write each value to the screen
  19.         Write starsplusses$(rows,columns)
  20.     Next
  21.     ;write a new line after each row
  22.     Print "" 
  23. Next
  24. WaitKey
  25.  
  26.  
  27. ;FUNCTION FINDCHAR$(i)
  28. ;returns * or +
  29. Function FindChar$(i)
  30.     If i = 0
  31.         Return "*"
  32.     Else If i = 1 
  33.         Return "+"
  34.     EndIf
  35. End Function