Hello,
I am loading an animation consisting of 8 24-bit bitmaps in DarkBASIC classic and the compilation of the program is fine, but in execution there is a runtime error that tells me it cannot load the bitmap. I single-stepped through the problematic areas of the code and found out that it would just not load
any bitmaps. I'll put the code in the source box and a snippet just to make life easier.
Thank you,
Juvy
snippet:
rem declare variables
trainX=100
trainY=100
Xadj=0
Yadj=0
trspeed=4
frametimer=timer()
trframe=1
set display mode 800,600, 32
sync on : sync rate 60
load image "media\trainframes\1.bmp",1
load image "media\trainframes\2.bmp",2
load image "media\trainframes\3.bmp",3
load image "media\trainframes\4.bmp",4
load image "media\trainframes\5.bmp",5
load image "media\trainframes\6.bmp",6
load image "media\trainframes\7.bmp",7
load image "media\trainframes\8.bmp",8
load image "media\usmap.bmp",9
remstart
Main Loop
remend
do
cls
if spacekey()=1 then end
if upkey()=1 then yadj=-1*trspeed
if downkey()=1 then yadj=trspeed
if leftkey()=1 then xadj=-1*trspeed
if rightkey()=1 then xadj=trspeed
trainX=trainX+xadj
trainY=trainY+yadj
DrawGraphics()
tmptimer=frametimer
frametimer=AnimateSprites(trainX,trainY,trframe,tmptimer)
xadj=0
yadj=0
sync
loop
end
`----------------------------------------------------------------------------
`------------------------------------FUNCTIONS-------------------------------
`----------------------------------------------------------------------------
function DrawGraphics()
paste image 1, 0,0
endfunction
function AnimateSprites(x,y,frame,timer1)
timer2=timer()
if timer2-timer1>10
timer1=timer()
inc frame
endif
if frame>8 then frame=1
sprite 1, x,y, frame
endfunction timer1
Juvenile Industries
Current Project: The First Room (FPS)
Side Projects: SHIPWRECK, the boss's school project