Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefined animations and support multiple simultaneous animations #104

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

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.

@andrewmcwatters andrewmcwatters added this to To do in Grid Engine 10 Oct 2, 2020
@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
Grid Engine 10
  
To do
Development

Successfully merging this pull request may close these issues.

None yet

2 participants