Animated: Pokemon Sprites

Section 7.I.1

The species sprites used by this plugin are long strips which contain each frame of the entire animation. The dimensions for these strips must always be broken up into squares. So for example, if you have a sprite 96 pixels tall that has 10 frames of animation, then the final dimensions for this sprite strip must be 960x96 so that each "frame" of this strip is a perfect square (96x96).

As long as your strips produce perfect squares for each frame, there is no set sizes that are required for your sprites. They can be as large or as small as you'd like, as long as they follow the square rule.


Sprite Scaling

As mentioned above, there are no limitations on how small or how large your sprites may be. The reason for this is because this plugin includes sprite scaling features that allow you to scale up or scale down any Pokemon sprite to your liking. This means that no matter what size your sprites are, they can be modified to fit within your game without having to manually edit the individual sprite itself.

There are two ways to affect sprite scaling. I'll cover both methods below.

Sprite Scaling through Settings

In the plugin Settings file, you will see the following two settings: FRONT_BATTLER_SPRITE_SCALE and BACK_BATTLER_SPRITE_SCALE.

As you can imagine, these control the overall sprite scaling for all Front and Back sprites, and act as the default scaling values for all Pokemon sprites. Back sprites will typically have a higher scaling than Front sprites in order to produce the effect of battlers on your side of the field appearing "closer" than those that are further away.

By changing the scaling for these options, you can change the overall sprite scaling for all Pokemon sprites in the game. Note that this does affect all Pokemon sprites at once, so these settings should only be used if you want to affect the overall scaling of sprites globally, as opposed to individual sprites. If you only want to affect the sprite scaling of a particular sprite, refer to the PBS method of scaling sprites.

Sprite Scaling through PBS

Sometimes you may only want to change the scaling applied to a specific sprite. This can easily be accomplished by editing the metrics for that species' sprites in the various pokemon_metrics.txt PBS files.

In these files, each species will have BackSprite and FrontSprite parameters, followed by at least two numbers. The first number correlates to the X-axis coordinates for the species' sprite in battle, while the second correlates to the Y-axis coordinates.

However, this plugin allows a third number to be entered for both parameters which controls the scaling of that specific sprite. For example, these are the parameters set for Bulbasaur by default:

[BULBASAUR]
BackSprite = 4,0
FrontSprite = 0,2

However, you may add a third additional number for both parameters to control the scaling for each sprite, like so:

[BULBASAUR]
BackSprite = 4,0,4
FrontSprite = 0,2,5

This would make it so Bulbasaur's Back sprite would be scaled up by 4x, while its Front sprite would be scaled up by 5x. This would override whatever sprite scaling settings were entered in FRONT_BATTLER_SPRITE_SCALE or BACK_BATTLER_SPRITE_SCALE in the plugin Settings.

Note that if you set the sprite scaling for a sprite that is already equal to the default value set in the plugin Settings, it will be treated as if you entered nothing, and the third number you entered here will not be saved whenever your PBS files are forced to update.

Also note that these sprite scaling metrics may also be applied via the debug mode Sprite Editor, the same way all metrics data can be edited. But I'll go over more on that in its own subsection.


Animation Speed

There are no minimum requirements for how long your sprite strips may be for each species. This means that some Pokemon may have really long animations, while others may have really short ones with only a few frames. This can cause some inconsistency issues however as one species may appear to animate abnormally "faster" than another simply due to a dramatic difference in length of their sprite strips.

To address this issue, this plugin implements methods of editing the animation speed for your sprite strips so that you can try to make everything look as visually consistent with each other as possible. To accomplish this, each Front and Back sprite is given an animation speed value that can be set to any one of these numbers:

  • 0: No animation (static sprite)

  • 1: Fast animation

  • 2: Normal animation

  • 3: Slow animation

  • 4: Very slow animation

By default, all sprites have an animation speed value of 2, which is the normal speed. However, there are two ways in which you may change the speed at which sprite strips animate, which I'll outline below.

Animation Speed through Settings

In the plugin Settings file, you will see the following setting: ANIMATION_FRAME_DELAY which is set to 90 by default.

This controls the overall speed at which all sprites animate by delaying each new "frame" of a sprite strip from appearing for a fraction of a second. This is calculated by taking the Animation Speed value of that sprite (speed), dividing it by 2, and then multiplying that by the number set in ANIMATION_FRAME_DELAY (delay). This final number is then divided by 1,000 to determine how many thousandths of a second of delay should be applied before each animation frame.

This leaves us with a simple equation of ((speed / 2) * delay) / 1,000. Let's run this calculation with a typical sprite that has a "Normal" animation speed value (2), and with the default frame delay (90).

((2 / 2) * 90) / 1,000 = 0.09

Two divided by itself is 1, and 90 multiplied by 1 is 90. Divide 90 by 1,000 and you get 0.09. This means that for any sprite with normal animation speeds, there will be a 0.09 second delay between each "frame" of the animation.

Now let's try running the same equation with a sprite with a "Fast" animation speed value (1).

((1 / 2) * 90) / 1,000 = 0.045

One divided by two is 0.5, and 90 multiplied by 0.5 is 45. Divide 45 by 1,000 and you get 0.045, which is half the number we calculated prior. Now it becomes clear why sprites with a fast animation speed will appear to animate "faster", since there is half as many fractions of a second delay between each frame of the sprite strip vs the "normal" speed that must wait 0.09 seconds. In essence, sprites with the "fast" speed value will animate twice as fast. The same logic applies in reverse for sprites that are set to slower speeds.

Now that we understand how sprite animation speeds are calculated, it becomes clear how the ANIMATION_FRAME_DELAY setting can be used to edit the overall speed of all of your Pokemon sprites. If you want your sprites to animate faster overall, then all you would need to do is reduce the number of this setting to your liking. If you want to slow down how your sprites animate, you would just need to increase this number. Although, I would personally try to use increments of 30, just to keep things consistent. But you can realistically set this to whatever amount of delay that you want.

Keep in mind however that editing this option will affect the animation speeds for all Pokemon sprites at once. So this setting should only be used if you want to affect the overall speed of sprites globally, as opposed to individual sprites. If you only want to affect the animation speed of a particular sprite, refer to the PBS method below.

Animation Speed through PBS

Sometimes you may only want to change the animation speed of a specific sprite. This can easily be accomplished by editing the metrics for that species' sprites in the various pokemon_metrics.txt PBS files.

These files now accept a brand new optional metric parameter called AnimationSpeed. This may be set to a single number, or an array of two numbers. If set to a single number, this allows you to adjust the animation speed value for all sprites used by that species.

For example, these are some of the parameters set for Greninja by default:

[GRENINJA]
BackSprite = -3,20
FrontSprite = 2,11
AnimationSpeed = 1

As seen here, Greninja's AnimationSpeed is set to 1, which is correlates to the "fast" animation speed. This means that both Greninja's front and back sprites will animate at this speed. However, what if Greninja's front and back sprite strips were of different lengths, and thus animated at different rates? Setting a universal animation speed for both sprites wouldn't be practical, as one would animate at a different speed than the other.

To resolve this issue, you can set AnimationSpeed to an array of two numbers, like so:

[FENNEKIN]
BackSprite = 0,3
FrontSprite = -2,3
AnimationSpeed = 1,2

In this example, AnimationSpeed is set to two numbers. In this scenario, the first number would correspond to the animation speed of the Back sprite, while the second number would correspond to the animation speed of the Front sprite. This means Fennekin's back sprite would animate at the "fast" speed (1), while its Front sprite will animate using the normal speed value (2). By setting the animation speed in this way, you can separately edit the speeds at which the sprites of a single species animate.

Note that the AnimationSpeed parameter is completely optional, and does not need to be set on every species, unlike some other parameters. Any species that doesn't have AnimationSpeed set in their PBS data will just default to the "normal" animation speed value of 2. If you set the animation speed for both the front and back sprites of a species equal to this default value, it will be treated as if you entered nothing, and it will not be saved whenever your PBS files are forced to update.

Also note that this animation speed metric may also be applied via the debug mode Sprite Editor, the same way all metrics data can be edited. But I'll go over more on that in its own subsection.


Shadow Sprites

While a Pokemon sprite is animating in battle, the shadow sprite that appears underneath them will also animate to reflect the Pokemon's movement. This is entirely different than the standard graphics that are utilized as shadows, which are just generic circles that appear beneath the Pokemon.

Instead, this is implemented by creating a copy of the Pokemon's sprite and modifying it to appear greyed out, stretched, and transparent. However, it will still animate exactly as the normal sprite does, following the Pokemon's actions exactly.

Sprites on both sides of the field have shadow sprites. However, since the shadows for the Pokemon on the player's side of the field would be completely hidden by the default battle UI anyway, shadows on the player's side are turned off by default. If you have a custom battle UI where you may have space available to display these sprites, then you may turn them back on by opening the plugin Settings and setting SHOW_PLAYER_SIDE_SHADOW_SPRITES to true.

You may also set a variety of metrics related to a Pokemon's shadow sprite. I'll cover this in more detail below.

Shadow Sprite Metrics

The shadow sprite for each species can be tweaked to set the coordinates in which they appear, as well as their overall size and visibility. This can easily be accomplished by editing the metrics for that species' sprites in the various pokemon_metrics.txt PBS files.

There are two parameters which can control elements of a Pokemon's shadow sprite. These are the ShadowSprite parameter and the optional ShadowSize. The ShadowX parameter which is present in Essentials by default is no longer used, and no longer serves a function. It can still be set in the PBS files without causing errors, but it will not do anything and will not be saved whenever your PBS files are forced to update.


ShadowSprite

This is a new parameter introduced by this plugin that contains all of the necessary metrics related to a Pokemon's shadow. This parameter must be set to an array of three numbers.

The first number in this array corresponds to the X-axis coordinates of the shadow sprite. Note that this one number controls where both the front and back sprite shadows appear on the X-axis. This is done by simply mirroring the position of the front sprite's coordinates, since the shadows appear opposite each other. For example, if the front sprite's X value is set to 2, then the back sprite's X value is equivalent to -2. Because of this, only one entry is required for this coordinate, and you don't need separate values for front/back sprites.

The second number in this array corresponds to the Y-axis coordinates of the shadow of the back sprite. Note that since shadows for back sprites are unlikely to ever be viewable by the player due to UI covering it up, it's rarely that important what this value is set to.

Lastly, the third number entered in this array corresponds to the Y-axis coordinates of the shadow of the front sprite. This is probably the most relevant value to set in terms of getting a Pokemon's shadow to appear in the proper place.


ShadowSize

While this parameter exists in base Essentials by default, it has been reworked to be used by this plugin in slightly different ways. First of all, this parameter is no longer required to be set, and is completely optional. If not set, it will just always be assumed that this is given the default value of 1.

Next, this parameter has been updated to accept more values. Previously, this could only be set to 0-3, corresponding to the size of the shadow graphic to use. Now, this can range between -9 to 9. In addition, this will no longer determine which graphic to use for the Pokemon's shadow. Instead, this will control the sprite scaling used for the Pokemon's shadow. The higher this number is, the larger the Pokemon's shadow will appear. The lower this number, the smaller the shadow will appear.

Note however that if this parameter is set to 0, this will count as having the Pokemon's shadow being "hidden", and no shadow will appear underneath the Pokemon in battle. You can use this setting if a species would make more sense not to display a shadow for some reason.

Last updated