im wondering about the lines you have here:
and the
to me these do not look correct so fix those first....
try something like this:
If GetSpriteXByOffset(sprite)-x <> 0 `does not equal zero
it may be ok with your else command but its kinda weird reading it that way
looking at your code closer...id just write it like this:
Function simplemove(sprite,x,y,speed) `simple move function w/ return value
`x direction
If GetSpriteXByOffset(sprite)-x <> 0 `does not equal 0
`check direction of movement/movement x
If GetSpriteXByOffset(sprite) < x `move sprite if not positioned
SetSpritePositionByOffset(sprite,GetSpriteXByOffset(sprite)+speed,GetSpriteYByOffset(sprite))
Endif
If GetSpriteXByOffset(sprite) > x `move sprite if not positioned
SetSpritePositionByOffset(sprite,GetSpriteXByOffset(sprite)-speed,GetSpriteYByOffset(sprite))
Endif
Endif
`y direction
If GetSpriteYByOffset(sprite)-y <> 0 `does not equal zero
`check direction of movement/movement y
If GetSpriteYByOffset(sprite) < y `move sprite if not positioned
SetSpritePositionByOffset(sprite,GetSpriteXByOffset(sprite),GetSpriteYByOffset(sprite)+speed)
Endif
If GetSpriteYByOffset(sprite) > Y `move sprite if not positioned
SetSpritePositionByOffset(sprite,GetSpriteXByOffset(sprite),GetSpriteYByOffset(sprite)-speed)
Endif
Endif
EndFunction
try something like that and see what happens.
a good way to check for bugs in your code is to throw a break in there just to see how far the computer is executing... maybe its not even getting into the second round of ifs...
an example i call code stepping is to just throw an end statement within the code to see if the application is even looking at that code or not. If your app closes then remove the end statement and goto the next if statement and test it out. sometimes you find an error where its not even processing that chunk of code and it really helps narrow things down to the exact errors you have.