home *** CD-ROM | disk | FTP | other *** search
/ Game Programming for Teens / GameProgrammingForTeens.iso / Source / chapter07 / demo07-14.bb < prev    next >
Encoding:
Text File  |  2003-04-06  |  801 b   |  40 lines

  1. ;demo07-14.bb - A Parallaxing Program
  2. Graphics 800,600
  3.  
  4. ;Set AutoMidhandle to true and draw everything to back buffer
  5. AutoMidHandle True
  6. SetBuffer BackBuffer()
  7.  
  8. ;IMAGES
  9. ;The close and quickly scrolled background
  10. backgroundimageclose = LoadImage("stars.bmp")
  11.  
  12. ;The further and slowly scrolled background
  13. backgroundimagefar = LoadImage("starsfarther.bmp")
  14.  
  15. ;Create scrolling tracker variable
  16. scrolly = 0
  17.  
  18. ;MAIN LOOP
  19. While Not KeyDown(1)
  20.  
  21. ;Clear the screen
  22. Cls
  23.  
  24. ;Tile both backgrounds at proper speed
  25. TileImage backgroundimagefar,0,scrolly
  26. TileImage backgroundimageclose,0,scrolly*2
  27.  
  28. ;Increment scrolly 
  29. scrolly=scrolly+1
  30.  
  31. ;Reset tracker variable if it gets too large
  32. If scrolly >= ImageHeight(backgroundimageclose)
  33.     scrolly = 0
  34. EndIf
  35.  
  36.  
  37.  
  38. Flip
  39. Wend
  40. ;END OF MAIN LOOP