Coins Items

From wiki
Jump to: navigation, search

Items are fairly broad in their types. Each type has it's own properties and uses.

This page is for coins, which will add to the player's money instead of being placed into the inventory.

Coin items are all items that have the following line;

"kind": "staxel.item.Coin",

These items must also include a Currency Component in order to work. Currency items will add to the player's petals upon picking up rather than go to the inventory.


Creating a Coin Item

Coins are created in much the same way as Craft Items. In fact you should follow the guide, Items#How to Make a Normal Item, until you finish all of the steps there.

Once you have gone through that guide, there are two more steps you will need to do. The first step is to change the "kind" from "staxel.item.CraftItem" to "staxel.item.Coin".

The second step depends on what you are using to create items.


Asset Manager

Navigate to the item you had created before. Head to the components property and click on the [...]. When the new window pops up, click on "Add" and select "currency".


Once that is done, the Asset Manager should have selected your new component. Check out the single property and change it to suit your need.


When you are done, close the window by clicking "OK". Save the asset and continue to "Build and Validate Assets" like the normal item tutorial.


Text Files

The second step is to add the following to the end of the item file created;

"currency": {
  "petalWorth": 1
},

With that out of the way, it is time to start editing these values. The outermost property "currency" is known as a Component that holds all the information. (Specifically the Currency Component).


Inside of that it includes a single properties. "petalWorth" determines how much the coin will be worth.

After you finished editing the values, rerun Content Builder and you are good to go.


Spawning in a Coin Item

Follow the guide at Items#How to Spawn an Item. When that guide mentions "kind", make sure to use "staxel.item.Coin" instead of "staxel.item.CraftItem" else you won't be able to spawn the item.


Config Options

The list of basic properties is included at Items#Config Options.

This item does need additional information. This additional information is contained in a Currency Component which needs to be added along with the item file.