I have the Beginners Guide To Dark Basic Game Programming and I am currently going through it and I understand it so far till now.
----------------------------------------------------------
`Beginner's Guide To DarkBASIC Game Programming
`Copyright (C)2002 Jonathan S. Harbour and Joshua R. Smith
`Chapter 10 - SaveBitmap program
`----------------------------------------------------------
`initialize screen
HIDE MOUSE
SYNC ON
PRINT "Press 'c' to draw circles, 's' to save bitmap and quit."
Create Bitmap 1,640,480
`perform a loop
DO
`check for keyboard input
key$ = INKEY$()
IF key$ = "c" OR key$ = "s"
SELECT key$
`draw random circles
CASE "c"
Set Current Bitmap 1
INK RGB(RND(255), RND(255), RND(255)), 0
CIRCLE RND(640), RND(480), RND(100)
Copy Bitmap 1,0
ENDCASE
`end the program
CASE "s"
EXIT
ENDCASE
ENDSELECT
ENDIF
SYNC
LOOP
`save the screen to a file and then quit
SET CURRENT BITMAP 1
GET IMAGE 1, 0, 0, Bitmap Width(1), Bitmap Height(1)
SAVE IMAGE "Bitmap.bmp", 1
DELETE IMAGE 1
SET CURRENT BITMAP 0
END
I understand everything in this program but I don't understand why it draws more than one circle on the screen. Could someone please explain what it is I am missing. I realize there is a Do Loop in there but shouldnt it run till I hit the S key? Because it doesnt I thin it draws like maybe 7 or 8 circles till I hit i C again/