Hi there.
I learning to program DarkBASIC which is my first attempt at programming. I'm currently working through 'Beginners Guide To DarkBASIC Game Programming' trying all the demonstration code as I work through the book so as to re-enforce my understanding.
I'm currently on chapter 10 which is introducing Bitmaps however when I try the BitmapStatus program which is demonstrating the use of the BITMAP EXIST command I receive the following
Runtime Error 1002 - Bitmap doesnt exist at line 20
I've checked my coding and it is a duplicate of the books. I've even tried the code that comes on the CD which accompanied the book yet I still get the same error. I've tried to work through the code and correct it yet I don't understand why the error is occurring.
I've posted the code below in the hope that someone can have a look and advise why the code is failing. I just don't want to move on until I have a clear understanding of how the CREATE BITMAP command works and prevent similar errors in the future.
Rem Project: BitmapStatus
Rem Created: 19/04/2005 14:55:57
Rem Author: Simon McGuirk
Rem ***** Main Source File *****
`initialise the variables
N = 0
status = 0
messages$ = ""
`create the status messages
DIM E$(2)
E$(0) = "does not exist"
E$(1) = "EXISTS!"
`create some bitmaps (randomly)
RANDOMIZE TIMER()
FOR N = 1 TO 31
IF RND(10) < 5
CREATE BITMAP N,640,480
ENDIF
NEXT N
`set up the screen
HIDE MOUSE
SET CURRENT BITMAP 0
`display status of each bitmap
FOR N = 0 TO 15
`check bitmaps 0-15
message$ = E$(BITMAP EXIST(N))
`display the status
TEXT 0, N * 20, "Bitmap " + STR$(N) + message$
`check bitmaps 16-31
message$ = E$(BITMAP EXIST(N+16))
`display the status
TEXT 320, N*20, "Bitmap " +STR$(N+16) + message$
NEXT N
WAIT KEY
END
Cheers in advance