Results 1 to 2 of 2

Thread: LUA ANIMATION LIB v4

                  
   
  1. #1
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    34
    Posts
    2,976
    Rep Power
    112

    psp LUA ANIMATION LIB v4

    new release via Grimfate126

    heres what Grimfate126 had to say-

    well, i guess this is my christmas present to all lua devs, anim lib 4!
    from the readme:

    This is the fourth release of Animation Lib. This version now supports all sprite sheets. Which makes it very easy for LUA developers.

    Heres a F&A for those who are confused

    Q: what IS animLib??
    A: its a library of functions meant to help lua devs with doing animations.

    Q: why should i use it?
    A: have you ever tried making an animation in lua? you know all those arrays and timers you have to make? and all the loops? well, animlib does this for you, and you can pretty much play an animation in only TWO LINES OF CODE (one to load the anim, one to blit it)

    Q:doesnt animlib 2 also have sprite sheet support? why should i use this instead?
    A: Animlib 2 only supported single column or single row sheets. with this version, you can use ALL SPRITE SHEETS. also, in animlib 2, sprite sheets were REALLY REALLY complicated. in this version, its even easier than blitting a normal animation!

    New Functions

    function SS.new(header, extension, nWidth, nHeight, where) -- loads a new animation, REALLY EASY.

    function SS:blit(x, y, delay) -- blits a current sprite sheet. EVEN EASIER.

    function SS:advancedBlit(x, y, delay, numLoops) -- same as SS:blit() but adds a loop functionality

    function SSause() -- pauses the sprite sheet

    function SS:resume() -- resumes the sprite sheet

    function SS:reset() -- resets the sprite sheet

    function SS:free() -- frees the sprite sheet from memory

    function SS:resetLoop() -- resets loop number, you should call this everytime after you use the SS:advancedBLit() function

    function SS:getTime() -- returns the current timer time

    function SS:getRow() -- returns the current row of the animation (not really needed)

    function SS:getColumn() -- returns the current column of the animation (not really needed)

    function SS:getLoops() -- returns the number of lops the animation has made. (only if youre using the advancedBLit function)

    as i said before, loading sprite sheets with this version is so easy. i cannot emphasize this enough.

    tutorial for loading/blitting spritesheets:

    -------------------------------------------------------------------------------------
    function SS.new(header, extension, nWidth, nHeight, where)
    -------------------------------------------------------------------------------------

    this function loads a new sprite sheet. arguments:

    header - the name of the sheet (without the extension)
    extension - the extension of the image
    nWidth - the width of every "frame" in your sprite sheet. ALL FRAMES MUST HAVE THE SAME WIDTH FOR ANIMLIB TO WORK!
    nHeight - the height of every "frame" in your sprite sheet. ALL FRAMES MUST HAVE THE SAME HEIGHT FOR ANIMLIB TO WORK!
    where - use this if your image is in another folder
    -------------------------------------------------------------------------------------
    function SS:blit(x, y, delay)
    -------------------------------------------------------------------------------------

    see? this is what i meant by how EASY it is. all you have to give is:

    x - x position of the animation.
    y - y position of the animation.
    delay - the delay you want inbetween frames, (in millisceonds)

    if you cant give that much info, then animlib is not for you.

    -------------------------------------------------------------------------------------
    function SS:advancedBlit(x, y, delay, numLoops)
    -------------------------------------------------------------------------------------

    this is the EXACT SAME THING as the previous blit function, BUT, this one lets you loop it a certain amount of times.
    with the OTHER blit function, it would continue endlessely, with this one, you can set how many loops you want it to do.

    numloops - the number of loops you want it to do

    after those number of loops, it will stop showing the animation.

    ALL OTHER FUNCTIONS ARE SELF-EXPLANATORY

    IMPORTANT:when loading a sprite sheet, you have to call it like this:

    Variable = SS.new(whatever)

    NOT

    Variable = ANIM.new(whatever)

    ONE MORE THING:

    i recommend reading this tutorial, before using this lib: (it might help a bit) find that here

    To use simply put this in your code:

    dofile("animLib.lua")

    --at the beginning of your code--

    well, thats it. if you have any questions, look in the sample file, "index.lua". chances are, itll answer your question. if it doesnt, you can PM me at the
    QJ forums. my name there is:

    Grimfate126

    you can also PM me if you want to tell me suggestions.

    please give credit to Grimfate126 if you use it.

    P.S. the "index.lua" file, when executed, will show 3 random sprite sheet animations i made in about 5 seconds.

    download and give feedback via comment
    download via Grimfate126

  2. #2
    DCEmu Newbie
    Join Date
    Jun 2006
    Posts
    6
    Rep Power
    0

    Default Nice

    Sorry for bringing up an old thread, but this is nice!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •