I noticed the Playsprite function is not even called from the code you listed.
Why so many timers? You don't need all of those. When you go to play the animation, store the current time + whatever delay you want (say 100), and add that to the time so you know when to increment the frame. Something like this:
function Playsprite(startframe, endframe, xcoordinate, ycoordinate, spritenumber)
frame = sprite frame(spritenumber)
if frame = 0 then frame = startframe
if timer() > tyme(1)
if frame < endframe
inc frame
else
frame = startframe
endif
tyme(1) = timer() + 100
endif
text 10,100,"frame: " +str$(frame)
text 10,120,"startframe: " + str$(startframe)
text 10,140,"endframe: " + str$(endframe)
text 10,160,"tyme(1): " + str$(tyme(1))
`switch through frames
sprite spritenumber,xcoordinate,ycoordinate,frame
endfunction
Also, I coded it to use the text command instead of using print commands, that way it will always be in the same spot.
You called for it to SYNC at the end of your function; this will slow down your game unnecessarily. Leave the SYNC in your main game loop, but don't add a SYNC to your functions.
The variable, tyme, will need to be made an array and that way you can use it for multiple sprites. DIM this array early in the code.
If you call the Playsprite function from your main loop, it should work. I see you have SYNC ON. Suggest your set the SYNC RATE to 60.