OK. The first code works like this.
`turn on manual syncing
sync on : sync rate 0
`create animated sprite
`Command syntax is
`CREATE ANIMATED SPRITE Sprite Number, Filename, Across, Down, Image Number
`filename is the filename of the image you want to use
`accross is how many images wide you want to cut it into
`down is how many images tall you want to cut it into
`it will start cutting from left to right and top to bottom
`notice my image is 4 images wide and 4 tall
create animated sprite 1, "animspr.bmp", 4, 4, 16
`position sprite
`Command syntax is
`SPRITE Sprite Number, XPos, YPos, Image Number
sprite 1, 0, 0, 1
do
if upkey() = 1
`animate sprite
`Command syntax is
`PLAY SPRITE Sprite Number, Start Frame, End Frame, Delay Value
`start frame is the image number (cut from the image file) you want to start looping from
`endframe is the last image number you want to loop to before restarting
`delay value is the time delay between frames in milliseconds
play sprite 1, 1, 16, 50
endif
sync
loop
[edit] The second code is like this.
`load bitmap to cut from
load bitmap "animspr.bmp", 1
`k is a temp variable used to keep track of the image numbers
`of the cut images.
k = 1
`t is a temp variable of the left x value to cut from
t = 0
`u is a temp variable of the top y value to cut from
u = 0
`v is a temp variable of the right x value to cut from
v = 127
`w is a temp variable of the bottom y value to cut from
w = 127
`cut the bitmap into images for sprite
`for i = 1 to images tall
`changes rows from top to bottom
for i = 1 to 4
`for i = 1 to images wide
`cuts the images on the left to right row
for j = 1 to 4
`command syntax
`GET IMAGE Image Number, Left, Top, Right, Bottom
`left, top, bottom, and right are the pixel corners
`of the screen to cut from like drawing a box
get image k, t, u, v, w
`increment the left x value to cut from by the width
`in pixels of the image you want to be cut
inc t, 128
`increment the right x value to cut from by the width
`in pixels of the image you want to be cut
inc v, 128
`increment the image number for each get image
`this will creat 16 images (4 wide * 4 tall)
inc k, 1
`next image on the x axis
next j
`rest the left x value to 0 to start back at the left side of the new row
t = 0
`rest the right x value to 127 to start back at the left side of the new row
v = 127
`increment the top y value by the image height you want to put you on the
`next row of images
inc u, 128
`increment the bottom y value by the image height you want to put you on the
`next row of images
inc w, 128
`next row of images on the y axis
next i
`delete the bitmap when done with it.
delete bitmap 1
`turn on manual syncing after you have cut your images
sync on : sync rate 20
`set base image
ImagNum = 1
`position sprite
sprite 1, 0, 0, ImagNum
do
if upkey() = 1
`animate sprite
`change the sprite image
sprite 1, 0, 0, ImagNum
`incremenrt the sprite image number each loop
inc ImagNum, 1
`if image number is greater than the last frame number then reset it to 1
if ImagNum > 16 then ImagNum = 1
endif
`draw changes to the screen
sync
loop
[edit2] Here is an example image that goes with both of those.
Red numbers are image numbers. Yellow shows which variable goes with which cutting line. Imagine it cuts where there is a red line.