Planimeter / game-engine-2d

Planimeter Game Engine 2D - LÖVE-based game engine for Lua
https://github.com/Planimeter/game-engine-2d/wiki
MIT License
736 stars 74 forks source link

Redefined animations and support multiple simultaneous animations #104

Open GamerGambit opened 3 years ago

GamerGambit commented 3 years ago

This is a breaking PR that changes how sprite animations are defined. The new change removes the previous limitation of a simple start and end frame pair, and replaces it with the ability to use sequential and out-of-order frames, frame ranges, and variable frame times, all in the same animation. An example of the new system might look like this

animations = {
    myAnimation = {
        frame1, frame2, { from = frame3, to = frame7 }, ...
    }
}

Single frame animations can be simplified to just myAnimation = 10 and variable frame times can be achieved by using

animations = {
    idleclosed = 1,
    idleopen = 8,
    opening = {
        { from = 2, to = 7 },
        {
            frameTime = 0.4,
            frames = 8
        }
    },
    closing = {
        { from = 8, to = 3 },
        {
            frameTime = 0.4,
            frames = 2
        }
    }
}

frames here is either a single frame, frame range, or sequence, or combination of those.

This PR also enables support for frame events firing multiple event names. For example:

events = {
    [ 33 ] = "rightfootstep",
    [ 35 ] = "leftfootstep",

    [ 65 ] = { "rightfootstep", "leftfootstep" },
    [ 67 ] = { "leftfootstep", "rightfootstep" }
}
andrewmcwatters commented 3 years ago

This is scheduled for Grid Engine 10 early next year.

andrewmcwatters commented 1 year ago

I have needed to step away from active development for a while, but this is now pending merge. I'm cleaning upstream up before we add this. Sorry it took two years, @GamerGambit!

What a bad two years.