game-engine-2d icon indicating copy to clipboard operation
game-engine-2d copied to clipboard

Redefined animations and support multiple simultaneous animations

Open GamerGambit opened this issue 5 years ago • 2 comments

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" }
}

GamerGambit avatar Sep 19 '20 19:09 GamerGambit

This is scheduled for Grid Engine 10 early next year.

andrewmcwatters avatar Sep 20 '20 00:09 andrewmcwatters

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.

andrewmcwatters avatar Oct 03 '22 19:10 andrewmcwatters