# Creating Gun Jsons/Jtk2ds

Gun Jsons/Jtk2ds are files that accompany your sprites to indicate hand positions, or clip and casing ejection positions. Jtk2d files are formatted the same as JSON files, but have the benefit of not appearing in **r2modman's config editor**, and so are generally more used. Click [here ](#converting-jsons-to-jtk2ds)to learn more about converting between Jsons and Jtk2ds in this tutorial.&#x20;

{% hint style="info" %} <mark style="color:blue;">**Everything in this tutorial that applies to Json files also applies to Jtk2d files.**</mark>
{% endhint %}

* Each animation of a gun requires at least 1 Json for the first frame containing at least hand positions to function
* Jsons must be located in the same location as your gun's sprites
* For every frame that has a different position, that frame will need its own Json
* A Json tied to a specific frame must match that frame's sprite name
* If you have a series of frames that have the exact same position, you only need a Json for the first frame it occurs for

There are two main ways to create gun Jsons: using tools we have created, or manually (nowadays, we NEVER do it manually - the tools are MUCH better), however, both options will be available for guidance.

## CREATING JSONs

{% tabs %}
{% tab title="Using Tools" %}

### Difficulty (Gun Animation Editor): 1/10 <img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQAkTlyeVttU3CJdmYk%2F-MfzOs8r_UzTe7WhP3Tc%2F-MfzUfw94jUTyreywn9u%2Fdifficulty_1.png?alt=media&#x26;token=feabeb3d-303c-456f-81cc-d8b65fefeacd" alt="" data-size="original">

The tools we have for creating jsons are great and are much easier than writing them manually. There are 3 available tools to use:

* Gun Animation Editor (adequately named <mark style="color:purple;">GAE</mark>)
* Gun Animation Editor 2 (<mark style="color:orange;">GAE2</mark>)
* Gun Animation Editor Reloaded (<mark style="color:yellow;">GAER</mark>)

Each of these is a more improved version of the one that came before - so the best one to use currently is <mark style="color:yellow;">**GAER**</mark> which this tutorial will cover how to use, if need be. Links to the other two will be available at the bottom.

**LINK TO&#x20;**<mark style="color:yellow;">**GAER**</mark>: [**https://github.com/pcrain/gungeon-modding-tools/releases**](https://github.com/pcrain/gungeon-modding-tools/releases)

Simply go to the most up-to-date version, and click on the *.exe* file to download it. Nothing other than the .exe should be needed to run.

***

### USING GAER

BASICS

Open up the .exe, and then you should see a basic UI with buttons on the top left.

Click "Open Gun For Editing" (shortcut **Ctrl+O**) and navigate/type in the file path to your gun sprites, and choose one of your sprites to open.

You should be met with this:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FXz0qMPaiVxono5iZHNKh%2Fimage.png?alt=media&#x26;token=4fe5b3f4-4ca3-481a-9633-df0836c700b2" alt=""><figcaption></figcaption></figure>

From here you can enable/disable which parts of the json you wish to write and follow the binds to move each part to the location you want.

{% hint style="info" %} <mark style="color:green;">Casing</mark> and <mark style="color:blue;">Clip</mark> positions can be freely enabled/disabled on a frame-frame basis,

But whether your gun uses <mark style="color:yellow;">1</mark> or <mark style="color:purple;">2</mark> hands must be consistent for **every frame** of **every animation** of your gun.
{% endhint %}

Ensure that you save each frame before moving on to the next - unless you have the *"Autosave on switch/exit"* option enabled.

#### Advanced View

Advanced view looks like this:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2F2GvSlQ97SHE0nEnJCMbg%2Fimage.png?alt=media&#x26;token=cf9418d2-1ce9-4681-a05c-d2b49530c69e" alt=""><figcaption></figcaption></figure>

This contains more options and additional information regarding hotkeys and each part of the json. Use either view depending on how much information you want on the screen at once!

The only hotkey of note would be **Ctrl + T - "Translate Gun Data"** which takes an entire animation and translates all of the offsets by a desired amount. This is mainly useful if your sprite size has changed or if only minor adjustments are made:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FKdSXbnubXqdVpRLXHwF9%2Fimage.png?alt=media&#x26;token=8e937832-0aad-46c4-9422-1c5b924773a7" alt=""><figcaption></figcaption></figure>

The "*Paste?*" checkboxes at the left of each option indicate whether you want to copy/paste specific parts of each json, useful if you like doing each part of the json one at a time or if you don't want a frame you're copying into to have a <mark style="color:green;">Casing</mark> position, etc.

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FSF4xHe8swoERHHrYHFtd%2Fimage.png?alt=media&#x26;token=aefc6237-e941-492e-be2c-f427ec6e7d0b" alt=""><figcaption></figcaption></figure>

#### Options

Clicking "*Show Options*" brings up a drop-down menu that looks like this:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FGXG3kgYItnHVIEpSwvRz%2Fimage.png?alt=media&#x26;token=56c281f7-8330-4694-9aa2-05cf39d4af38" alt=""><figcaption></figcaption></figure>

Most of these options are self-explanatory, but a few that aren't are described below:

* *Autosave on switch/exit* - autosaves changes made to each frame as a json file in your directory upon switching frames/exiting the program
* *Show hand sprite overlay* - with this disabled, hands will appear as a small circle instead of how they would look in game. Toggle at your preference
* *Make backups when batch translating* - when using the "Batch Translate" tool (shown in advanced view) you can choose to make a *backup* of your previous jsons *juuust in case something goes horribly wrong.* The backups will appear in a seperate folder in your directory:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FVRav19v1RW8t3Uak35Cc%2Fimage.png?alt=media&#x26;token=ac5bdac8-768c-4ec3-adb2-6580a178c81d" alt=""><figcaption></figcaption></figure>

* *Export as .jtk2d instead of .json* - highly reccommended, as explained previously, exports all jsons as jtk2ds, which makes no functional difference but prevents them from showing up where they shouldn't
* *High DPI Display* *(WIP)* - makes the screen resolution BIG if you like it that way (WIP so if it sucks don't hate it)

### Demo Video

{% file src="<https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FvgWeOFCqMoIhMbFIZ1qc%2FGAER%20Demo.mp4?alt=media&token=1b707847-d65e-4c77-b017-6eefac10d2a0>" %}
Demo video for the basics of GAER
{% endfile %}

***

### Older versions of GAE

Access the original GAE and GAE 2 using this link:

{% embed url="<https://thunderstore.io/c/enter-the-gungeon/p/TeamGAE/Gun_Animation_Editor/>" %}

Click "Manual Download" and extract the files normally.
{% endtab %}

{% tab title="Manual" %}

### Difficulty (Manual): 2/10 <img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQAkTlyeVttU3CJdmYk%2F-MfzOs8r_UzTe7WhP3Tc%2F-MfzUfwFWuhAzqPkJVXO%2Fdifficulty_2.png?alt=media&#x26;token=d25ab038-2436-477d-9299-f8cb134d8602" alt="" data-size="original">&#x20;

Now, if you want to make a json the old-fashioned way (Why?!) or your sprite is too large to fit in the editor you will have to manually create a json for each frame.&#x20;

Here is an example of a one-handed json:

{% file src="<https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQAkTlyeVttU3CJdmYk%2F-MXsbLQg-0zi5hizE5U-%2F-MXsy-gbZnSO7EOMMZSk%2Fancient_katana_idle_001.json?alt=media&token=a4f751f9-8e59-4428-9a7f-74d8a5d3513d>" %}
One-handed Json
{% endfile %}

```
"name": "PrimaryHand",
"position": {
   "x": 0.0001,
   "y":0.0001,
   "z": 0.0
},
```

Here, the values of "x", and "y" have to be replaced with wherever you want the hand -where each pixel is 0.0625. These start from the bottom left of your sprite. Check out Pixel Measurement Conversions for some conversions.\
\
Two-handed json example:

{% file src="<https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQAkTlyeVttU3CJdmYk%2F-MXsbLQg-0zi5hizE5U-%2F-MXszINo2Jzt13jHxNFL%2Felectric_sword_idle_001.json?alt=media&token=b60f5719-4289-421e-ab33-9c7a1076b67c>" %}
Two-handed Json
{% endfile %}
{% endtab %}
{% endtabs %}

## CONVERTING JSONS TO JTK2Ds

Since Jsons and Jtk2ds are completely the same format, the only thing you need to do to convert from the two is to rename the file extension. In Windows 11 by default, file extensions are *hidden*, and you you need to enable them to rename the extension:

<figure><img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQAkTlyeVttU3CJdmYk%2Fuploads%2FvS3P2Xog75weTm4GFikL%2Fimage.png?alt=media&#x26;token=bb6da6ec-c61e-4d19-b29b-3599f5f4dae6" alt=""><figcaption><p>Go to View > Show > File name extensions</p></figcaption></figure>

This can be quite tedious to do en masse, however, so one of us made a tool to convert a folder full of jsons into jtk2d:

{% embed url="<https://github.com/SpecialAPI/JsonToJtk2d/releases>" %}

Just drag the folder with your jsons onto the .exe and you should be good to go! Don't worry if your sprites are in there - etc. the program should automatically ignore those files.
