Skip to content

Conversation

@GamerGambit
Copy link
Member

@GamerGambit GamerGambit commented Sep 19, 2020

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
Copy link
Member

This is scheduled for Grid Engine 10 early next year.

@GamerGambit GamerGambit changed the title Added spriteAnimation class and redefined animations Redefined animations and support multiple simultaneous animations Oct 27, 2020

-- `#sequence == 2` should be true only for single frame anims. The first sequence should be the frameTime command, second should be frameIndex.
-- This prevents single frame animations from constantly calling `spri:onAnimationEnd`, also single frame animations dont need to loop
if (#self.sequence == 2) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent comment.

@andrewmcwatters
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants