Hi Grog,
I have commented your code with what i think is what it is doing and also some questions thrown in there. I changed the last function a bit, only because the select wasnt required with there only being 1 case involved, just incase you weren't aware, just taking an opportunity to be helpful as well.
Thanks a lot for your help on this.
`set resolution and colour depth
set display mode 640,480,32
`let the pc choose a suitable sync rate for refreshing the screen
sync rate 0
`turn sync on
sync on
`function to load media
loadMedia()
`using the loaded image 1 as sprite 1 and sets the x,y position of it
sprite 1,0,300,1
`ryu function case 1, timer of 5000, what is y for?
`First position Ryu stands and the animation plays of him bobbing away for 5000 milliseconds
Ryu(1,5000,0)
`ryu function case 2, coordinate to walk to is 400, y?
`calling case 2 makes ryu walk to position 400
Ryu(2,400,0)
`ryu function case 1, timer of 5000, y?
`After Ryu has walked he stands again and the animation plays of him bobbing
`away for 5000 milliseconds
Ryu(1,5000,0)
end
` Ryu Animations
function Ryu(z,x,y)
`select used to see whether ryu is to stand(1) or walk(2)
select z
` Standing (x is the timer)
case 1
`variables holding sprite 1's current x and y coordinates
cx=sprite x(1):cy=sprite y(1)
`variable to hold the system time when the function is first called
a=timer()
`begin do loop
do
`play sprite from already created animated sprite, starting at 1 to frame 5
`at a delay of 100 milliseconds
play sprite 1,1,5,100
`this positions the sprite and if it isnt included the resolution decreases?
`when standing the sprite isnt repositioning, how is this affecting it??
`Dont get it
sprite 1,cx,cy,1
`if the current time is greater than the function start time + x(5000 ms) then exit
if timer()>a+x then exit
`pastes image 50 to x and y coordinates of 0,0
`was 0,0 bottom left corner?
`do you need a black image 640 * 480 for this?
`paste image 50,0,0
`refresh screen end of each loop
sync
`starts loop again - the 5 frames take 5 * 100 = 500ms so this loop
`should go 10 times before exiting
loop
endcase
` Walk Right (x is the coordinate to walk to)
case 2
`variables for sprite x and y positions
cx=sprite x(1):cy=sprite y(1)
`time function starts
a=timer()
`loop begins
do
`if the current timer is greater than start time + 50 ms then add 1 to cx
`and a = the current time
if timer()>a+50 then inc cx:a=timer()
`if the sprite x position is greater than or equal to the end x coordinate of 400
`then exit the function
if cx>=x then exit
`plays frames 5 to 10 of image 1 at a delay of 100ms
play sprite 1,5,10,100
`repositions the sprite after playing it
sprite 1,cx,cy,1
`paste image 50,0,0
`refresh screen
sync
loop
endcase
endselect
endfunction
` Misc Stuff
function loadMedia()
` Load Graphics
`this function cuts up the image into blocks 5 across and 2 down
`image and sprite number of 1
`is this function the one that does anti-aliasing?
create animated sprite 1,"ryu.bmp", 5, 2, 1
`loads a picture file as an image number 1 amd texture flag 1 means
`the image is preserved without adding mipmaps, scaling or filtering
`which retains its pixel perfect quality
`what are mipmaps?
`is this function used to remove the anti-aliasing?
load image "ryu.bmp",1,1
endfunction