home *** CD-ROM | disk | FTP | other *** search
/ Game Programming for Teens / GameProgrammingForTeens.iso / Source / chapter10 / demo10-02.bb < prev    next >
Encoding:
Text File  |  2003-04-06  |  924 b   |  39 lines

  1. ;demo10-02.bb - Demonstrates problem with not using FlushKeys
  2.  
  3. Graphics 800,600
  4.  
  5. ;Create the background image that will be scrolled
  6. backgroundimage = LoadImage ("stars.bmp")
  7.  
  8. ;Create variable that determines how much background has scrolled
  9. scrolly = 0
  10.  
  11. ;MAIN LOOP
  12. While Not KeyDown(1)
  13.  
  14. ;Scroll background a bit by incrementing scrolly
  15. scrolly = scrolly + 1
  16.  
  17. ;Tile the background
  18. TileBlock backgroundimage,0,scrolly
  19.  
  20. ;Reset scrolly if the number grows too large
  21. If scrolly > ImageHeight(backgroundimage)
  22.     scrolly = 0
  23. EndIf
  24.  
  25. ;Print necessary text
  26. Locate 0,0 ;Locate text to top left corner of screen
  27. Print "When you want to quit, press Esc."
  28. Print "Hopefully, a message stating 'Press any key to exit' will appear after you hit Esc."
  29.  
  30. ;Delay the program for a fraction of a second 
  31. Delay 25
  32.  
  33. Wend ;END OF MAIN LOOP
  34.  
  35.  
  36. Print "Press any key to exit"
  37.  
  38. ;Wait for player to press a key
  39. WaitKey