Need some options for Sprite Animation Group in Atlas (SOLVED)

Right now, the sprite animation is going to play as soon as the game object they belong to is spawned. I want to have a checkbox on the animation groups in atlas that sets auto-start animation behavior instead of this default behavior.

Another option is I want to set which frame the animation will use as still image when the PLAYBACK_ONCE_ animation has done. Instead of default to last frame of the played animation. (Currently, last frame for once forward, first frame for once backward and once pingpong)

Thanks

Hmm, but can’t you set the default animation to a single frame (the first frame of a multi frame animation)? This would solve issue #1 wouldn’t it?

I’m not sure issue number #2 should be taken care of by the engine. The expected behaviour is what you describe (last frame for once forward and first frame for backward and pingpong). If you need anything else you could easily program this behaviour into a reusable script with an exposed property defining the end animation for sprites with a single animation or into a reusable Lua module for sprites with many different animations. You could use something like this animator module that I just wrote. Example usage:

local animator = require("animator")

function init(self)
	self.animator = animator.create("#sprite")
	self.animator.set_done_animation("attack", "idle")
	self.animator.set_done_animation("idle", "look")
	self.animator.set_done_animation("look", "idle")
end

function on_input(self, action_id, action)
	if action_id == hash("attack") and action.released then
		self.animator.play("attack")
	end
end

function on_message(self, message_id, message, sender)
	self.animator.on_message(message_id, message)
end

In this example I’ve defined that once the “attack” animation has finished playing the “idle” animation should play. And since this allows nice chaining of multiple animations I’ve also defined that when the “idle” animation has finished the “look” animation should be played. And you can do a looping sequence of animations as well, in this case “look” will play “idle” and “idle” will play “look” in an infinite loop until another animation breaks the loop.

2 Likes

Ok. Solved both issues.

Many thanks for the module :smile:

Not sure if it’s a common case, but it would be great to have an option to play once_forward animation backwards. Thanks!