thanks, that works. I have a problem though. I purposly took out all of the walls from my data, but it thinks that there are walls at
1,3 2,3 3,3 3,2 3,1...there aren't. Here's my code:
sync on
set display mode 800,600,32
rem load images
load image "c:\sprites\wall.bmp",1
load image "c:\sprites\sprite2.bmp",2
load image "c:\sprites\grass.bmp",3
rem movable sprite postion
guyx=100
guyy=100
oldguyx=100
oldguyy=100
rem the map is 14 tiles by 10 tiles
dim map(10,14)
rem reads the map
for x = 1 to 14
for y = 1 to 10
read map
map(x,y)=map
if map=1 then paste image 1,x*50,y*50,1
if map=0 then paste image 3,x*50,y*50,1
next x
next y
oldposx=2
oldposy=2
posx=2
posy=2
oldmovedx=100
oldmovedy=100
movedx=100
movedy=100
do
sync
rem moves sprite
if upkey()=1 then guyy=guyy-5: movedy=movedy-5
if downkey()=1 then guyy=guyy+5: movedy=movedy+5
if leftkey()=1 then guyx=guyx-5: movedx=movedx-5
if rightkey()=1 then guyx=guyx+5: movedx=movedx+5
if movedx>=oldmovedx+50
posx=posx+1
gosub col
if blocked = 0
movedx=oldmovedx
guyx=oldguyx
posx=oldposx
endif
if blocked = 1
guyx = Oldguyx
guyy = OldGuyy
movedx=oldmovedx
movedy=oldmovedy
posx=Oldposx
posy=Oldposy
blocked = 0
endif
endif
if movedx<=oldmovedx-50
posx=posx-1
gosub col
if blocked = 0
movedx=oldmovedx
guyx=oldguyx
posx=oldposx
endif
if blocked = 1
guyx = Oldguyx
guyy = OldGuyy
movedx=oldmovedx
movedy=oldmovedy
posx=Oldposx
posy=Oldposy
blocked = 0
endif
endif
if movedy>=oldmovedy+50
posy=posy+1
gosub col
if blocked = 0
movedy=oldmovedy
guyy=oldguyy
posy=oldposy
endif
if blocked = 1
guyx = Oldguyx
guyy = OldGuyy
movedx=oldmovedx
movedy=oldmovedy
posx=Oldposx
posy=Oldposy
blocked = 0
endif
endif
if movedy<=oldmovedy-50
posy=posy-1
gosub col
if blocked = 0
movedy=oldmovedy
guyy=oldguyy
posy=oldposy
endif
if blocked = 1
guyx = Oldguyx
guyy = OldGuyy
movedx=oldmovedx
movedy=oldmovedy
posx=Oldposx
posy=Oldposy
blocked = 0
endif
endif
sprite 2,guyx,guyy,2
loop
col:
blocked = 0
if map(posx,posy)=1 then blocked = 1
return
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
Whats's wrong. Thanks again.
.....