------------------------------------------------------------------------------

// ANIMATION LIB VERSION 1//
// BY: Grimfate126 //
// RELEASE DATE: 8-31-06 //

------------------------------------------------------------------------------

------------------------------------------------------------------------------

.:// NEW FUNCTIONS \\:.

AnimLoad(header, frames, anim_Id, extension)

AnimEdit(timer_name, command)

AnimBlit(Id, anim_x, anim_y, timer_name, counter, delay)

------------------------------------------------------------------------------

------------------------------------------------------------------------------

.:// AnimLoad(header, frames, anim_Id, extension) \\:.


NOTE: ALL animation frames MUST be in the format of: header, then frame number, then extension.

This function load an animation depending on the arguments that you give it.

"header" stands for the beginning name of the image.

EXAMPLE:

Suppose we have 4 images:

test1.png
test2.png
test3.png
test4.png

here, our header would be "test", our frame number would be either 1, 2, 3, or 4, AND our extension would be "png" 
(we dont need the period cause the function automatically does that.)

NOW, there is only one thing left, anim_Id.

anim_Id is an array that YOU WILL HAVE TO MAKE IN YOUR OWN CODE. 

if thats confusing, (which is probably is) here is how we would load an animation which had the images test1.png, test2.png
etc:


-- START CODE --

example = {}
AnimLoad("test", 4, example, "png")

-- note that the words test and png are in quotes.

-- END CODE --

the above code will load the images test1.png, test2.png, test3.png, AND test4.png into an array called "example".

check the example that i wrote, which should have come with this, if you are sill confused. 

------------------------------------------------------------------------------

------------------------------------------------------------------------------

.://AnimBlit(Id, anim_x, anim_y, timer_name, counter, delay)\\:.

this function takes 6 arguments:

1. Id - this is the array you created. (like 'example' in the above section)
2. anim_x = this is the x position of the animation
3. anim_y, this is the y position of the animation.
4. timer_name - this is the name of the timer THAT YOU MUST CREATE IN YOUR OWN CODE. (ill explain below)
5. counter - this is a var that will count what frame you are on. you can put anything here. just try not to make it too long.
6. delay - this is the delay between each frame (in milliseconds)

SO, lets take the two sections and make a animation: 

-- CODE START -- 

example = {}
example_timer = Timer.new() -- this is the timer you have to create. it can also be named anything.

AnimLoad("test", 4, example, "png")

while true do

	AnimBlit(example, 50, 50, example_timer, example_counter, 200)

screen.waitVblankStart()
screen:flip()
end

-- CODE END --

that code will display an animation at 50, 50 on the psp screen.

------------------------------------------------------------------------------

------------------------------------------------------------------------------

.://AnimEdit(timer_name, command)\\:.

this is used to edit the timer. this function takes only 2 arguments:

1. timer_name - this is the name of the timer you want to edit. (in the above case it would be example_timer)
2. command - this is what you want it to do:

puttting: AnimEdit(example_timer, 1) will start the timer.
puttting: AnimEdit(example_timer, 2) will stop/pause the timer.
puttting: AnimEdit(example_timer, 3) will reset the timer to 0.

------------------------------------------------------------------------------

------------------------------------------------------------------------------

to use:

simply put : dofile("animLib.lua") OUTSIDE of your main loop.

thats it! youre now ready to use animLib!

------------------------------------------------------------------------------

------------------------------------------------------------------------------

if you use this, please give credit to Grimfate126. if you forget, thats ok. (try not to "forget" on purpose ;)


HaVe FuN!!!!!

