home *** CD-ROM | disk | FTP | other *** search
- Rem * Title : Making a Bob
- Rem * Author : DBS-MB
- Rem * Date : 1st August 99
- rem ===================================================
- rem DARK BASIC EXAMPLE PROGRAM 2
- rem ===================================================
- rem This program will make a bob
- 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 Load back ground to bitmap 1
- load bitmap "back.bmp",1
-
- rem When you load a bitmap that bitmap becomes the current bitmap
- rem where all drawing is done
-
- rem Use this command to set drawing to the screen
- set current bitmap 0
-
- rem Grab image 1 from bitmap
- get image 1,18,17,156,196
-
- rem Now we will make a bob
- bob 1,100,100,1
-
- rem Copy background to screen
- copy bitmap 1,0
-
- rem The is were on screen bob will apear
- acrossscreen=100
- downscreen=100
-
- rem This is were bob will move to
- targetacross=0
- targetdown=0
-
- get image 2,0,0,150,150
-
- rem Reset current bitmap to visible bitmap zero
- set current bitmap 0
-
- do
-
- rem Check for return key being pressed
- if returnkey()=1
-
- rem Set the text printing to top of the screen
- set cursor 0,0
-
- rem Print bob info
- print "making a bob"
- print "bob x pos ",bob x(1)
- print "bob y pos ",bob y(1)
- print "bob offset x ",bob offset x(1)
- print "bob offset y ",bob offset y(1)
- print "bob width is ",bob width(1)
- print "bob height is ",bob height(1)
- print "bob image number ",bob image(1)
-
- rem Wait till you relese the return key
- repeat :until returnkey()<>1
-
- rem Clear any text from the screen
- paste image 2,0,0
-
- endif
-
- rem Have we pressed the left mouse button
- if mouseclick()=1
- rem Get were mouse is across the screen
- targetacross=mousex()
- rem Get were mouse is down the screen
- targetdown=mousey()
- endif
-
- rem This next part home the bob on the target x and target y position
- if acrossscreen<targetacross:acrossscreen=acrossscreen+1:endif
- if acrossscreen>targetacross:acrossscreen=acrossscreen-1:endif
- if downscreen<targetdown:downscreen=downscreen+1:endif
- if downscreen>targetdown:downscreen=downscreen-1:endif
-
- rem Draw the bob at the new position
- bob 1,acrossscreen,downscreen,1
-
- loop
-
- rem Clear the screen
- cls
-
- rem Remove the bob from memory
- delete bob 1
-
- rem Remove image 1 from memory
- delete image 1
-
- rem End the program
- end
-