home *** CD-ROM | disk | FTP | other *** search
/ Game Programming for Teens / GameProgrammingForTeens.iso / Source / chapter07 / demo07-13.bb < prev    next >
Encoding:
Text File  |  2004-08-28  |  599 b   |  31 lines

  1. ;demo07-13.bb - Demonstrates a moving background
  2. Graphics 800,600
  3.  
  4. ;Draw everything to backbuffer
  5. SetBuffer BackBuffer()
  6.  
  7. ;IMAGES
  8. ;Load background image
  9. backgroundimage = LoadImage("stars.bmp")
  10.  
  11. ;Set up scrolling tracker variable
  12. scrolly = 0
  13.  
  14. ;MAIN LOOP
  15. While Not KeyDown(1)
  16.  
  17. ;Tile the background at the y position of scrolly
  18. TileBlock backgroundimage,0,scrolly
  19.  
  20. ;Scroll the background a bit by incrementing scrolly
  21. scrolly=scrolly+1
  22.  
  23. ;If scrolly gets too big, reset it to zero
  24. If scrolly >= ImageHeight(backgroundimage)
  25.     scrolly = 0
  26. EndIf
  27.  
  28.  
  29. Flip
  30. Wend
  31. ;END OF MAIN LOOP