home *** CD-ROM | disk | FTP | other *** search
/ Game Programming for Teens / GameProgrammingForTeens.iso / Source / chapter08 / demo08-03.bb < prev    next >
Encoding:
Text File  |  2003-04-06  |  857 b   |  42 lines

  1. ;demo08-03.bb - Demonstrates rotation a rectangle
  2. Graphics 800,600
  3.  
  4. ;Handle images from the center
  5. AutoMidHandle True
  6.  
  7. ;Load the animated rectangles
  8. rectanglesimage = LoadAnimImage("rectangles.bmp",250,250,0,2)
  9.  
  10. ;Create variable that counts how many rotations occured
  11. rotationcount = 0 
  12.  
  13. ;MAIN LOOP
  14. While Not KeyDown(1)
  15. ;Clear the screen
  16. Cls
  17.  
  18. ;Position text at top left of screen
  19. Locate 0,0
  20.  
  21. ;Print the number of rotations
  22. Print "Number of Rotations: " + rotationcount
  23.  
  24. ;Draw the rectangle image with the proper frame
  25. DrawImage rectanglesimage,400,300,rotationcount Mod 2 
  26.  
  27. ;Increment the rotation count variable
  28. rotationcount = rotationcount + 1 
  29.  
  30. ;Wait a while
  31. Delay 100 
  32.  
  33.  
  34. Wend
  35. ;END OF MAIN LOOP
  36.  
  37. Print "Press any Key to Exit"
  38. ;Clear key buffer
  39. FlushKeys 
  40.  
  41. ;Wait for player to press a key before exiting.
  42. WaitKey