ok, I'm new to DarkBasic and I've just finished my first pong game, now I'm moving on to something more complicated, so I wrote this code, none of this is final, it is just my first test, and it takes ages to load the images. Could anyone help me by showing the proper way to do it.
p.s. I only have DarkBasic classic
rem set some variables for stuff here
speed=1
playx=15
playy=15
rem set some arrays here
dim floortest(41,30)
for test=1 to 41
for test2=1 to 30
floortest(test, test2)=1
next test2
next test1
rem remember the screen is
rem get the graphics
load bitmap "tiles.bmp"
get image 1, 0, 0, 15, 15
get image 2, 14, 0, 30, 15
get image 3, 0, 14, 15, 30
get image 4, 14, 14, 30, 30
cls
rem the loop for actually playing the level
sprite 1, 0, 0, 1
do
for test=1 to 41
for test2=1 to 30
if floortest(test, test2)=1
paste sprite 1, (test-1)*15, (test2-1)*15
endif
next test2
next test1
sprite 4, playx, playy, 4
rem key press loop
do
if upkey()=1 then playy=playy-speed : exit
if downkey()=1 then playy=playy+speed : exit
if leftkey()=1 then playx=playx-speed : exit
if rightkey()=1 then playx=playx+speed : exit
if spacekey()=1 then set cursor 0,0 : print playx,",", playy
loop
rem collision detection
if playy<1 then playy=1
if playx<1 then playx=1
if playy>463 then playy=463
if playx>626 then playx=626
cls
loop