Attack animations

*For the project that aims to create every battle animation, see All Animations Project.*
*For how to define a move, see Defining a move.*
*For making animations that show in the overworld, see Field animations.*

This page describes how to create **attack animations**. It also applies to other battle animations, such as the ones played to indicate a shiny Pokémon or a stat change.

## Which animation editor?

There are two animation editors available in Essentials. The first is the default RPG Maker XP one, which is the Animations tab in the Database (F9), and is used to make field animations (grass rustling and so forth). That's not the one you want here.

The animation editor you want to use for battle animations is the one made specifically for Essentials. It is found in the Debug menu in-game. This is referred to as the Animation Editor (with capital letters).

The Animation Editor works a lot like the Database's Animations tab, except with a lot more functionality. It can therefore be useful to play around with the Database's Animations tab first, to get a grip on the basics. Any tutorial written for the Database's Animations tab will also serve you well with the Animation Editor.

## Layout of the Animation Editor

At the top of this page is a screenshot taken in the Animation Editor. It contains several elements, which are described below.

**Top left - the canvas**

* This is the big picture that looks like a battle between a Pikachu and a Charizard. It is where you construct the animation, by placing cels. There is a dark red border around it, which won't be shown in-game - it is there to make it easier for you to deal with cels that are near the edge of the screen.
* Cels with a white box around them are the cels in the current frame. Cels with a blue box are cels in the previous frame. This can help you to position cels, by placing them relative to where they were in the previous frame.

**Bottom left - frame and animation navigation**

* "Frame:" - The frame of the animation which you are currently working on. The frame number begins at 1. Click the arrows to move between frames.
* 「Total Frames: X」- The total number of frames in that animation. Click to change this number.
* 「Set Animation Sheet」- Choose the animation sheet to be used for the animation.
* 「List of Animations」- Shows all the existing animations. You can open another one to work on, create a new one, or rename or delete an existing one. You can also change the maximum number of animations allowed by modifying the number at the bottom and clicking "Resize Animation List". Press "Esc" to close.

**Bottom right - animation name and palette**

* The palette is a row of cel sprites taken from the animation sheet. You can scroll through them with the thin arrows at the sides, and click a cel sprite to select it. When you click an empty spot in the canvas, you will draw a new cel using the selected cel sprite.
* "Name:" - The name of the animation. Nearly all animations have guidelines on how to name them. You cannot edit the name here, but you can do so when viewing the List of Animations.

**Right - the tool menu**

* 「SE and BG...」- Set the sound(s) to play for the animation (you can choose the sound file to play, its volume and pitch). Also, set the background and foreground images for this animation (you can choose the file, its offset, its colour and opacity, and the frame to start showing it at). The commands at the bottom let you change the frame number when the currently selected sound/image will play/appear, and you can delete the selected timing.
* 「Cel Focus...」- Set the default cel focus for the animation (see below), which is used by all new cels created. Note that changing this will *not* affect the focus of any cel that already exists.
* 「Paste Last」- Makes the current frame a copy of the previous frame.
* 「Copy Frames...」- Copies a sequence of frames elsewhere. Select a sequence of frames, then choose the frame where the copy sequence should start from.
* 「Clear Frames...」- Deletes all cels in a sequence of frames. Does not delete locked cels.
* 「Tweening...」- Interpolates the cels between one frame and another frame for a smoother animation. Can choose a set of cels to interpolate and the frames to interpolate between. Can interpolate position, pattern, zoom, angle, opacity and blending.
* 「Cel Batch...」- Modify the properties of multiple cels in multiple frames at once. Can modify position, pattern, zoom, angle, opacity, blending, flip, priority and focus.
* 「Entire Slide...」- Shifts the position of all cels in a sequence of frames by a given amount (positive values mean shift right/down, negative values mean shift left/up).
* 「Play Animation」- Plays the complete animation as though the player's Pokémon (Pikachu) was using it.
* 「Play Opp Anim」- Plays the complete animation as though the opposing Pokémon (Charizard) was using it.
* 「Import Anim...」- Imports an animation from an .anm file and turns the current animation into it.
* 「Export Anim...」- Exports the animation's details to an .anm file in the game's main folder.
* 「Help」- Displays a help screen.

## Drawing an animation

With an animation open, select a cel sprite in the palette at the bottom of the screen. Click in an empty spot of the canvas to draw a cel.

To select a cel on the canvas, simply click within its bounding box. A selected cel will have a black box around it, rather than white. If you hold "Alt" while clicking on a cel, you will only select that cel if you are clicking on a non-empty part of that cel's sprite (you can select a cel this way even if you click outside of its bounding box). Alternatively, you can press Tab to cycle through all the cels in the current frame.

With a cel selected, you can do the following things:

* Click and drag to move the cel around.
* Use the arrow keys to move the cel 8 pixels in that direction (hold "Alt" to move it 2 pixels instead).
* Keyboard shortcuts:
	+ P - Open the cel's properties screen.
	+ E/R - Rotate the cel left/right in increments of 10 degrees.
	+ +/- (numeric pad) - Change the sprite's zoom factor in increments of 10%.
	+ L - Lock or unlock the cel. A locked cel cannot be moved or deleted.
	+ Delete - Delete the cel.

You can right click on any part of the canvas to open a menu. This lets you open a cel's properties screen, cut/copy/paste cels, delete or renumber a cel, or define a path for a cel to move over for the next number of frames (either a smooth curve or a freehand path). Most of these options only work if a cel is selected.

Once one frame is complete, you can move to the next frame and carry on.

You should draw the animation as though the player's Pokémon (Pikachu) is using it.

## Animation sheets

An animation sheet is a picture file containing the various sprites that can be used to create an animation. It is like a tileset for animations. Each "tile" of the animation sheet is known as a "cel sprite".

Each cel sprite must be exactly 192x192 pixels in size. The animation sheet can have up to 5 cel sprites in a row, and any number of rows (this is similar to tilesets, which must have exactly 8 tiles in a row and any number of rows).

An animation can only use one animation sheet, so all the cel sprites required for it must be in the same sheet.

## Cel focus

Each cel has its own focus. A focus is an anchor point for that cel, and that cel will be displayed relative to the thing it focuses on, no matter whereabouts on the screen that focus is.

If there are two focal points, the cel will be displayed in the same relative position to both of them. For example, if a cel is positioned halfway between two focal points, then no matter where those focal points happen to be, the cel will be halfway between them.

There are four possible focuses a cel can choose from. Their names indicate what the cel will be focussed on.

* **User** - For parts of an animation which solely affect the user (Pikachu), such as charging-up particles or anything that is self-inflicted. Also used for various effects (e.g. poison, stat changes, shininess).
* **Target** - For parts of an animation which solely affect the target (Charizard), such as slash marks or an impact burst.
* **User and target** - For parts of an animation which affect both the user and the target, such as beams that travel from one to the other.
* **Screen** - For moves and effects which affect the field in general, such as weather and Trick Room. What is shown in the Animation Editor is always exactly what appears in battle.

The majority of animations will use just one type of focus throughout. However, some animations can mix and match (e.g. Leech Seed, which will use "User and target" for the projectiles flying through the air, then "Target" for the seeds sprouting on the opponent).

It is important to note that the "User and target" focus can reposition cels in such a way that the animation looks wrong if used by, say, an opposing Pokémon (Charizard) on a player's Pokémon (Pikachu). The 「Play Opp Anim」 button in the tool menu will be useful for figuring out if this happens. If so, don't panic! You can make a second version of the animation specifically for opposing Pokémon to use, via the "OppMove" naming convention (see below).

## Animation naming conventions

The vast majority of battle animations will need to follow specific naming conventions. There are three kinds of animations that have naming conventions: "Move:" animations, "OppMove:" animations and "Common:" animations.

### Move:

"Move:" animations are named **Move:** followed by the internal name of the move it depicts, e.g. `Move:FIREPUNCH`. They are shown automatically when using that move.

If a "Move:" animation does not exist for a particular move, then the game will instead try to use a default animation - this will either be the animation of a predefined other move with the same type as the move being used, or Tackle's animation (`Move:TACKLE`) if that can't be found. If the game cannot find either of these animations, then no animation is shown.

### OppMove:

These are the same as "Move:" animations, except they are drawn as though the opposing Pokémon (Charizard) is using the move against the player's Pokémon (Pikachu). This type of animation is used if the regular "Move:" animation for a move will not look good when an opposing Pokémon is using it.

"OppMove:" animations are named **OppMove:** followed by the internal name of the move it depicts, e.g. `OppMove:FIREPUNCH`. They are shown automatically when using that move.

When an opposing Pokémon uses a move, it first checks if that move has an "Oppmove:" animation for it. If so, it uses that, and if not, it will try to use the "Move:" animation for it. If there is no "Move:" animation for the move either, it goes through the same default animation fallbacks as mentioned above.

### Common:

"Common:" animations are animations which are called by name from the scripts, but are not "Move:" or "OppMove:" animations. They are used for a variety of status changes and lingering effects. These include:

* `Common:Shiny`, `Common:Shadow` - Shown when a shiny Pokémon/Shadow Pokémon enters battle.
* `Common:StatUp`, `Common:StatDown` - Shown when one of a Pokémon's stats is raised/lowered.
* `Common:Poison`, `Common:Sleep`, etc. - Typically shown at the end of a battle round, to indicate that a Pokémon still has that status problem.
* `Common:Sunny`, `Common:Rain`, etc. - Weather animations, shown at the start of battle and at the end of each battle round while the weather persists.

"Common:" animations are named **Common:** followed by anything you like (preferably something identifiable). It is the "anything you like" part which is written in the scripts when the animation is called.

Common animations are shown with the code `pbCommonAnimation("Poison", attacker, opponent)` (or similar). Examples include:

* `pbCommonAnimation("LeechSeed", recipient, battler)`
* `pbCommonAnimation("LevelUp", battler)`
* `pbCommonAnimation("SeaOfFire")`

If there is no Common animation with the given name, then no animation is shown.

Note that there is no "OppCommon:" animation naming convention. If a different animation needs to be played depending on which side of the field the affected Pokémon is on (or which side of the field is affected), this will need to be manually coded. See the code for the Pledge moves for an example.

## Animation numbering conventions

In addition to naming conventions, some animations also need to follow numbering conventions. Basically, a move or effect that has multiple animations should have those animations listed in sequence with no gaps.

This applies to:

* All multi-hit moves. Each hit is a separate animation, even if the animations are supposed to look the same. There should be a number of animations equal to the maximum possible number of hits, listed in order. Examples include Beat Up and Comet Punch.
* Two-turn moves, such as Fly. The charging animation should be the second animation, listed immediately after the attacking animation.
* Fusion Bolt and Fusion Flare. The more powerful version of the animation should be second.
* Techno Blast. The Normal-type animation should be first, followed by the Electric-, Fire-, Ice- and Water-type versions in that order.
* Brick Break. The version showing this move breaking an opponent's Reflect/Light Screen should be second.
* Future Sight and Doom Desire. The initial use's animation (foreseeing the attack) should be first, and the actual attack's animation (the attack hitting) should be second.

In all cases, the first animation should follow the appropriate naming convention, but every other animation *must not*. The game will be confused if there are multiple animations for a single move that follow the naming conventions. For all animations except for the first, you can name them anything you like, so long as they do not follow the naming conventions (although it is useful to name them something informative like "Fury Attack hit 2" or "Fly charging").

While the ability Parental Bond can turn almost every one-hit move into a multi-hit move, you don't need to worry about allowing for this. Parental Bond is hard-coded to use the "Common:ParentalBond" animation for its second hit.

## Saved animation data

Attack animations are saved in the folder "Data" in the file "PkmnAnimations.rxdata".

There is also a data file called "move2anim.dat" in the same folder, which contains an array that matches up the numbers of the Move/OppMove animations to their corresponding move ID number (e.g. matches animation number 275 to the move Tackle). This file is generated each time the game is compiled.