Semi Format: Sprite Animation
Each sprite animation is defined by one file. The recommended extension is .semi.anim
. This file must reference an already loaded sprite collection by ID.
To use these in your mods, you would put the relevant files in your mod's resources
folder, and then use the LoadSpriteAnimation(string path)
method to load them
Format
Just like the sprite collection format, the sprite animation format is line based (every line is a separate instruction). The same definition of whitespace also applies.
Properties
The way you specify properties is exactly the same as with collections, however, the list is much smaller:
id <id>
e.g.$id my_anim
Works exactly the same as in sprite collections.name <name>
e.g.$name My animation
Works exactly the same as in sprite collections.collection <id>
e.g.$collection my_mod:my_coll
References a sprite collection by ID. This sprite collection must be loaded before the animation. Required.defaultfps <num>
e.g.$defaultfps 12
Sets the default FPS for all clips which don't specify it with thefps
attribute.
Clips
The biggest difference between the two formats is the clip syntax. Each clip contains an instruction that serves as a header and is then followed by a list of frame instructions. The header is specified with a line like this:
The name
argument obviously specifies the name of the clip. Note that animation clips are not ID pooled like sprite definitions.
Note that the line must always end in a colon character, no matter how many attributes are specified. Here is a list containing all of the currently available clip attributes:
prefix <namespace>
e.g.prefix my_mod
As already mentioned, sprite definitions are ID pooled. To avoid having to retype the namespace over and over while specifying frames (as for most collections all the definitions are in the same namespace), you can use this attribute to tell Semi to fill in this namespace for all definitions where one isn't specified, as opposed to using the default (gungeon:
).wrapmode <mode>
e.g.wrapmode once
This attribute determines how this clip will be played. The available options formode
are:loop
- Self explanatory.loopsection
- Effect unknown.once
- Self explanatory.pingpong
- The clip will go back and forth (from start to end, then reversed and back to the start, then forward again, etc.)randomframe
- Chooses a random frame each time.randomloop
- Effect untested, likely chooses a random frame each time forever whilerandomframe
only does it for the amount of times that there are frames in the clip.single
- Effect unknown.loopfidget
- Effect unknown.
fps <num>
e.g.fps 12
Sets the FPS (frames per second) of the clip. This overrides the$defaultfps
property.
Example
Frames
There's one last simple, but arguably most important instruction - a frame definition. Clip instructions may be followed by a bunch of frame instructions, which will be inserted into the last specified clip (creating a nice looking header/list syntax).
You specify one like this:
The sprite definition to be used for this frame is referenced by ID in def
, and the attributes specify certain contextual behavior of this animation frame:
invulnerable
If the animation is assigned to the player, they will be invulnerable during this frame.offground
If the animation is assigned to the player, they will be considered as not touching ground during this frame (e.g. you will not fall into pits).
Example
Full Example
Last updated