I've written a code in Dark Basic Pro. It worked fine then suddenly it stopped wroking properly.
pn=1 : gridx=0 : gridy=0
tip$="Press [ENTER] & I'll get you started in this dangerous world"
draw sprites first
`charachters
`player
set image colorkey 255,255,255
create animated sprite 1,"chara\navi.bmp",3,4,pn
sprite 1,400-(sprite scale x(1)/2),300-(sprite scale y(1)/2),pn
set sprite priority 1,1
`great tree of knoledge
create animated sprite 2001,"chara\gtree.bmp",2,1,300
sprite 2001,200,32,300 : hide sprite 2001
set sprite priority 2001,1
`cells
load bitmap "cells\sps.bmp",1
get image 301,0,0,64,64
get image 302,65,0,86,25 : `farmer = @
delete bitmap 1
`------------------------
load bitmap "cells\tiles.bmp"
GET IMAGE 201,0,0,32,32 : `water
GET IMAGE 202,32,0,64,32 : `wall
GET IMAGE 203,64,0,96,32 : `grass
get image 204,96,0,128,32 : `tree
get image 205,128,0,160,32 : `vertical wall
get image 206,160,0,192,32 : `horizontal wall
get image 207,192,0,224,32 : `(city) floor
get image 208,224,0,256,32 : `(city) horizontal wall
get image 209,256,0,288,32 : `(city) vertical wall
get image 210,288,0,320,32 : `gate
cell(0,0)
gridx=0 : gridy=0
do
oldx=sprite x(1) : oldy=sprite y(1)
text 0,0,str$(gridx)+","+str$(gridy)
if upkey()=1
play sprite 1,1,3,100
sprite 1,sprite x(1),sprite y(1)-1,pn
endif
if downkey()=1
play sprite pn,7,9,100
sprite 1,sprite x(1),sprite y(1)+1,pn
endif
if leftkey()=1
play sprite pn,10,12,100
sprite 1,sprite x(1)-1,sprite y(1),pn
endif
if rightkey()=1
play sprite pn,4,6,100
sprite 1,sprite x(1)+1,sprite y(1),pn
endif
if sprite y(1)<0 then gridy=gridy+1 : cell(gridx,gridy)
if sprite y(1)>480 then gridy=gridy-1 : cell(gridx,gridy)
if sprite x(1)<0 then gridx=gridx-1 : cell(gridx,gridy)
if sprite x(1)>640 then gridx=gridx+1 : cell(gridx,gridy)
for c=1300 to 1600
if sprite exist(c)=1
if sprite collision(1,c)=1 then sprite 1,oldx,oldy,pn
endif
next c
`----------------------------specials------------------------
if gridx=1 and gridy=0
show sprite 2001
else
hide sprite 2001
endif
if sprite collision(1,2001)=1 and sprite visible(2001)
sprite 1,oldx,oldy,pn
if controlkey()=1
repeat
show sprite 2001 : play sprite 2001,1,2,100
center text 320,240,"Great Tree of Knoledge:"
center text 320,250,tip$
ink RGB(255,255,0),rgb(0,0,0)
center text 320,260,"Press [SPACE] to continue"
ink RGB(255,255,255),rgb(0,0,0)
until spacekey()=1
endif
endif
if sprite collision(1,farmarno)=1 and controlkey()=1
repeat
text sprite x(farmarno), sprite y(farmarno)+10,"Help! Help! That blasted lepricaun is after my cows again"
until spacekey()=1
wait 500
repeat
text sprite x(farmarno), sprite y(farmarno)+10,"I'll give you my Dojo membership"
if returnkey()=1 then gridx=0 : gridy=0 : sprite 1,320,240,pn : cell(gridx,gridy)
until spacekey()=1
endif
loop
function cell(gridx,gridy)
spr=0 : pn=1
for moo=1000 to 200
if sprite exist(moo)=1 then delete sprite moo
next moo
tmp$="cells\"+str$(gridx)+","+str$(gridy)+".cel"
if file exist(tmp$)=0
repeat
text 320,240,"Error: missing cell "+str$(gridx)+","+str$(gridy)
until spacekey()=1
end
endif
OPEN TO READ 1,tmp$
for ty=0 to 15
for tx=0 to 21
read byte 1,tmp
tile$=chr$(tmp)
if tile$="w"
sprite 1300+spr2,tx*32,ty*32,202
spr2=spr2+1
endif
if tile$="s"
sprite 1300+spr2,tx*32,ty*32,201
spr2=spr2+1
endif
if tile$="g"
sprite 1000+spr,tx*32,ty*32,203
spr=spr+1
endif
if tile$="f"
sprite 1000+spr,tx*32,ty*32,207
spr=spr+1
endif
if tile$="t"
sprite 1300+spr2,tx*32,ty*32,204
spr2=spr2+1
endif
if tile$="|"
sprite 1300+spr2,tx*32,ty*32,205
spr2=spr2+1
endif
if tile$="\"
sprite 1300+spr2,tx*32,ty*32,209
spr2=spr2+1
endif
if tile$="_"
sprite 1300+spr2,tx*32,ty*32,208
spr2=spr2+1
endif
if tile$="-"
sprite 1300+spr2,tx*32,ty*32,206
spr2=spr2+1
endif
if tile$="h"
sprite 1000+spr,tx*32,ty*32,207
spr=spr+1
sprite 1300+spr2,tx*32,ty*32,301
set sprite priority 1300+spr2,1
spr2=spr2+1
endif
if tile$=":"
sprite 1000+spr,tx*32,ty*32,203
spr=spr+1
sprite 2001+spr3,tx*32,ty*32,210
set sprite priority 2001+spr3,1
spr3=spr3+1
endif
if tile$="@"
sprite 1000+spr,tx*32,ty*32,203
spr=spr+1
sprite 1300+spr2,tx*32,ty*32,302
farmarno=1300+sp2
set sprite priority 1300+spr2,1
spr2=spr2+1
endif
next tx
next ty
close file 1
if sprite x(1)>630 then sprite 1,10,sprite y(1),pn
if sprite x(1)<10 then sprite 1,630,sprite y(1),pn
if sprite y(1)>470 then sprite 1,sprite x(1),10,pn
if sprite y(1)<10 then sprite 1,sprite y(1),470,pn
endfunction
When i go to the next grid/cell it says it doesn't exist when it does!!!
Please help