I would suggest the following:
1. There is no need to load images every time you execute the function. Load them once somewhere else in the code.
2. It appears that you have created sprites simply for collision checking purposes. Perhaps you could save the x and y positions of the main sprite, check for collision and restore the old coordinates if indeed a collision occurs. I don't know what type of game you are making; perhaps you could describe what you want to do in more detail.
3. Depending upon the size of the sprites, you are likely always going to be colliding with another sprite. The only way I can even get it to move is down using 32 X 32 sprites.
4. The syntax error is caused by the LOAD IMAGE commands in the function. If you remove them as I suggested, it should run. You have to list the filename and path in quotes in the LOAD IMAGE command.
The following code may be helpful to you:
sync on : sync rate 60
ink rgb(255,0,0),0
box 0,0,32,32
get image 1,0,0,32,32
ink rgb(0,255,0),0
box 0,0,32,32
get image 2,0,0,32,32
ink rgb(0,0,255),0
box 0,0,32,32
get image 3,0,0,32,32
global xpos, ypos, OLDxpos, OLDypos
xpos = 400 : ypos = 200
sprite 1,xpos,ypos,1
for s = 2 to 5
sprite s,rnd(300) + 15,rnd(300) + 15,rnd(2) +1
next s
repeat
Charmove()
sync
until spacekey() = 1
end
FUNCTION Charmove()
OLDxpos = xpos : OLDypos = ypos
If Upkey()=1 and up = 0 then dec ypos,4
if downkey() = 1 and down = 0 then inc ypos,4
if rightkey() = 1 and right = 0 then inc xpos,4
if leftkey() = 1 and left = 0 then dec xpos,4
sprite 1,xpos,ypos,1
collide = sprite collision(1,0)
if collide > 0
xpos = OLDxpos : ypos = OLDypos
endif
sprite 1,xpos,ypos,1
endfunction
This code creates images (colored boxes) and puts sprites 2-5 on the screen randomly and places sprite 1 over to the right side. You can move sprite 1 around and when it collides with one of the other sprites, it will not move into it.
If this is totally off base from what you wanted, let me know.
So many games to code.....so little time.