home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / sprite / exam05.dba < prev    next >
Encoding:
Text File  |  2000-04-09  |  1.6 KB  |  71 lines

  1. Rem * Title  : Scaling a Sprite
  2. Rem * Author : DBS-MB
  3. Rem * Date   : 1st August 99
  4. rem ===================================================
  5. rem DARK BASIC EXAMPLE PROGRAM 5
  6. rem ===================================================
  7. rem This program will draw a scale a sprite on screen 
  8. rem ---------------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),1
  12.  
  13. rem Load a bitmap on to the screen
  14. load bitmap "face.bmp"
  15.  
  16. rem Grab image 1 from bitmap
  17. get image 1,18,17,156,196
  18.  
  19. rem clear the screen
  20. cls
  21.  
  22. rem now we will make a sprite and draw it off screen
  23. sprite 1,100,100,1
  24.  
  25. rem get sprite width and find the middle of it going across
  26. rem get sprite height and find the middle of it going down
  27. rem new offset for sprite 1 
  28.  
  29. offset sprite 1,(sprite width(1)/2),(sprite height(1)/2)
  30.  
  31. rem the is were on screen sprite will appear
  32. acrossscreen=(640/4)
  33. downscreen=(480/4)
  34.  
  35. rem press left mouse button to quit
  36. rem move mouse left and right to resize sprite
  37.  
  38. repeat
  39.  
  40.     if returnkey()=1
  41.         cls 0
  42.         set cursor 0,0
  43.         print "using the scale sprite command"
  44.         print "sprite x ",sprite x(1)
  45.         print "sprite y ",sprite y(1)
  46.         print "sprite scale x ",sprite scale x(1)
  47.         print "sprite scale y ",sprite scale y(1)
  48.         repeat:until returnkey()<>1
  49.         cls
  50.     endif
  51.  
  52.     rem draw the sprite at the new position
  53.     sprite 1,acrossscreen,downscreen,1
  54.  
  55.     rem resize sprite
  56.     scale sprite 1,mousex()
  57.  
  58. until mouseclick()=1
  59.  
  60. rem clear the screen
  61. cls 
  62.  
  63. rem remove the sprite from memory
  64. delete sprite 1
  65.  
  66. rem remove image 1 from memory
  67. delete image 1
  68.  
  69. rem End the program
  70. end
  71.