Annie, a rudimentary 2D sprite assistant

Hello everyone :wave:

I am currently working on the internal workings of my game, and as a test to prove to myself I’ve done at least some of it in a non-spaghetti way I decided to try and clean up and streamline one of the utilities I wrote to solve some of my problems and publicize it. Hopefully I did an okay job!

This is Annie!
The name comes from ‘ani’ short for ‘animator’ which is the original name of the module in the initial project.

Annie was made to help me streamline my workflow when working with sprites that had animation groups where the sprites might not be the same size. To keep a character or object aligned in this case, you need to adjust the offset of a dummy gameobject that only exists for the purpose of managing this alignment.

With Annie, managing this alignment is consolidated into data structures that can be as clean or as dirty as you need them to be, and basic logic that usually needs to be wrapped around msg.post() or sprite.play_flipbook() is taken care of, with somewhat of an unobtrusive implementation.

Currently the main features Annie offers are:

  • basic animation switch for lightweight integration into responsive logic in your update() (Annie doesn’t send the 'play_animation' message if already playing the animation)
  • ability to bypass the animation switch, to force a replay of the current animation
  • automatic alignment of the parent gameobject on playing an animation
  • ability to lock and unlock the animation instance
  • ability to retain the cursor position between different animations
  • a built-in container for linking timers to something like the animation_done message

Combined with a tool I created that runs as a Defold game which makes it easy to serialize the required hardcoded offsets for animations, aligning my characters went from guess-and-check to GUI-based and has saved a lot of time I was previously wasting. (I am also hoping to improve and publish this serialization tool).

I’m hoping to improve on Annie’s limitations in the future. If you find Annie useful, or have a suggestion for improvement I would love to hear about it!

14 Likes

Great! Thank you for sharing! I’ll try to include it in the next newsletter!

5 Likes