I'm doing a little top-down moving-around style thing just because I want to learn how to use sprites, but I can't get the collision to work right; the bloke can just go into the wall and then he'll stop like he's supposed to, but he tends to go quite far in before it detects the collision and I don't think he can figure out how to get back out. He's not really very clever, to be honest (but don't tell him - it'll hurt his feelings)
Basically, the sprite just keeps getting stuck on the walls. But that would be boring to say.
ink 0,rgb(73,73,116)
cls
sync on
sync rate 0
gosub loadsprites
gosub loadroom
imvar=1
imvart=10
chardir=4
charx=300
chary=200
tcharx=300
tchary=200
speed=1
do
if shiftkey()=1 : speed=2 : else : speed=1 : endif
if upkey()=1 and rightkey()=0 and leftkey()=0 and downkey()=0 then chardir=0 : tchary=chary-speed : imvart=imvart+1
if upkey()=0 and rightkey()=1 and leftkey()=0 and downkey()=0 then chardir=4 : tcharx=charx+speed : imvart=imvart+1
if upkey()=0 and rightkey()=0 and leftkey()=0 and downkey()=1 then chardir=8 : tchary=chary+speed : imvart=imvart+1
if upkey()=0 and rightkey()=0 and leftkey()=1 and downkey()=0 then chardir=12 : tcharx=charx-speed : imvart=imvart+1
sprite 99,tcharx,tchary,imvar+chardir
if sprite collision(99,0)<>0
tcharx=charx
tchary=chary
else
charx=tcharx
chary=tchary
endif
if imvart>49 then imvart=imvart-40
imvar=imvart/10
sprite 99,charx,chary,imvar+chardir
sync
loop
loadsprites:
load bitmap "char1.bmp",1
for t=0 to 3
get image t+1,t*32,0,t*32+31,31 : `up
get image t+5,t*32,32,t*32+31,63 : `right
get image t+9,t*32,64,t*32+31,95 : `down
get image t+13,t*32,96,t*32+31,127 : `left
next t
delete bitmap 1
create bitmap 1,640,480
ink rgb(60,0,0),rgb(73,73,116)
box 0,0,639,479
ink 0,rgb(73,73,116)
box 10,10,629,469
get image 18,0,0,639,479
delete bitmap 1
create bitmap 1,2,2
cls rgb(73,73,116)
get image 98,0,0,1,1
delete bitmap 1
return
loadroom:
sprite 98,0,0,18
return
the image I'm loading is just a 128*128 picture with 16 32*32 pictures of the guy walking in different directions. I've been looking at this for hours now without getting anywhere (although I'm hardly concentrating... trying to give up smoking again today and i suck at it)
EDIT: never mind

i think it's the image - when I turn him round the slight offset from the center of the sprite means that he actually goes further onto the wall when he turns round.
http://jamesmason01.googlepages.com/index.htm