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

  1. ;demo10-08.bb - Demonstrates drawing a mouse cursor
  2. Graphics 640,480
  3. ;Set default drawing surface to back buffer
  4. SetBuffer BackBuffer()
  5.  
  6. ;IMAGES
  7. ;Load the background and the mouse cursor
  8. backgroundimage = LoadImage("stars.bmp")
  9. mouseimage = LoadImage("mouseimage.bmp")
  10.  
  11. ;Set handle to top left for mouseimage
  12. HandleImage mouseimage,0,0
  13.  
  14. ;Create an indicator variable for scrolling background
  15. scrolly = 0
  16.  
  17. ;MAIN LOOP
  18. While Not KeyDown(1)
  19.  
  20. ;Scroll background a bit by incrementing scrolly
  21. scrolly = scrolly + 1
  22.  
  23. ;Tile the background
  24. TileBlock backgroundimage,0,scrolly
  25.  
  26. ;Reset scrolly if the number grows too large
  27. If scrolly > ImageHeight(backgroundimage)
  28.     scrolly = 0
  29. EndIf
  30.  
  31. ;Reset printing commands to top left hand corner
  32. Locate 0,0
  33. Print "Mouse is easier to find now, huh"
  34.  
  35. ;Print X and Y coordinates
  36. Print "MouseX: " + MouseX()
  37. Print "MouseY: " + MouseY()
  38.  
  39. ;draw the mouse image
  40. DrawImage mouseimage,MouseX(),MouseY()
  41.  
  42. ;Flip front and back buffers
  43. Flip
  44.  
  45. Wend ;End of Main loop