home *** CD-ROM | disk | FTP | other *** search
- Rem * Title : Scaling a Sprite
- Rem * Author : DBS-MB
- Rem * Date : 1st August 99
- rem ===================================================
- rem DARK BASIC EXAMPLE PROGRAM 5
- rem ===================================================
- rem This program will draw a scale a sprite on screen
- rem ---------------------------------------------------
-
- rem Set the ink to white and paper color to black
- ink rgb(244,214,210),1
-
- rem Load a bitmap on to the screen
- load bitmap "face.bmp"
-
- rem Grab image 1 from bitmap
- get image 1,18,17,156,196
-
- rem clear the screen
- cls
-
- rem now we will make a sprite and draw it off screen
- sprite 1,100,100,1
-
- rem get sprite width and find the middle of it going across
- rem get sprite height and find the middle of it going down
- rem new offset for sprite 1
-
- offset sprite 1,(sprite width(1)/2),(sprite height(1)/2)
-
- rem the is were on screen sprite will appear
- acrossscreen=(640/4)
- downscreen=(480/4)
-
- rem press left mouse button to quit
- rem move mouse left and right to resize sprite
-
- repeat
-
- if returnkey()=1
- cls 0
- set cursor 0,0
- print "using the scale sprite command"
- print "sprite x ",sprite x(1)
- print "sprite y ",sprite y(1)
- print "sprite scale x ",sprite scale x(1)
- print "sprite scale y ",sprite scale y(1)
- repeat:until returnkey()<>1
- cls
- endif
-
- rem draw the sprite at the new position
- sprite 1,acrossscreen,downscreen,1
-
- rem resize sprite
- scale sprite 1,mousex()
-
- until mouseclick()=1
-
- rem clear the screen
- cls
-
- rem remove the sprite from memory
- delete sprite 1
-
- rem remove image 1 from memory
- delete image 1
-
- rem End the program
- end
-