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

  1. ;demo 07-03.bb - Demonstrates Scaling
  2.  
  3. Graphics 1024,768
  4.  
  5. ;VARIABLES
  6. ;Create the variables that define the rectangle
  7. rectbeginx = 25 ;The x coordinate of the top left corner
  8. rectbeginy = 25 ;The y coordinate of the top left corner
  9. rectwidth  = 256 ;The x coordinate of the bottom right coordinate
  10. rectheight = 256 ;The y coordinate of the bottom right coordinate
  11.  
  12. ;MAIN SECTION
  13. ;Make sure the text goes near the bottom of the screen
  14. Locate 0,700 
  15. Print "This is our first rectangle." 
  16.  
  17. ;Draw the first rectanlge, and make it not filled
  18. Rect rectbeginx,rectbeginy,rectwidth ,rectheight,0
  19.  
  20. ;Ask the user what the scaling factor is
  21. sxy# = Input ("What would you like the scaling factor to be? (Ex: 50% = .5)? ==> ") 
  22.  
  23. ;Multiply the width and height by the scaling factor
  24. rectwidth = rectwidth  * sxy# 
  25. rectheight = rectheight * sxy#
  26.  
  27. ;Draw the new rectangle 
  28. Rect rectbeginx,rectbeginy,rectwidth,rectheight,0 
  29.  
  30. Print "Press any key to exit." 
  31.  
  32. ;Wait for the user to press a key before exiting.
  33. WaitKey