Pikifen/Creating object types

This page will instruct you on how to create new object types in Pikifen. This includes a new type of enemy, new type of Pikmin, etc.

General idea
In order for the engine to detect a type of object, it will check the "Game_data/Types" folder. Inside are several folders, one for each category of object (enemies, gates, etc.). Inside each category are folders for the different types of objects (the different types of enemies, different types of leaders, etc.). Finally, inside those are some text files with data about how the object works, its animations, or its script.

Creating a new object type
To create a new object type, make a folder for it in the right category, and create an empty text files inside called "Data.txt". Inside, you will write all of the object's attributes, like the name, its movement speed, etc. These take on the form of, and there is one attribute per line. So for instance, to name Louie's object type, you'd have the line  in the file.

Some attributes are mandatory, some are optional, some apply to all object types, and some only apply to certain categories of object type. You can get a list of attributes that apply to all object types in the following sub-sections of this page, and then check what attributes exist for that category by visiting the category's article from the list. After you're done setting the attributes, you must create the animations for the object type; use the animation tutorial for this. Finally, some object types will also need a script to run. To figure out if your object will need a script or not, check the list of categories and if it does, read the object script tutorial to learn what you need to do.

After you have done that, you can boot up the engine, go to the area editor, place your new object in an area, hit play, and watch it in action!

Naturally, instead of creating your own files from scratch, you may copy and paste an existing object's files and simply edit those.

Mandatory attributes
The following attributes must exist, regardless of category.


 *  : Name of the object type. e.g. "Olimar", "Red Pikmin", "Cloaking Burrow-nit".

Recommended attributes
The following are attributes that you really should have, but the engine can run without them.


 *  : This object will only want to hunt down objects of this target type. i.e. it will only consider those an "opponent" (provided they're also in an opposing team). See  below for more information.
 *  : This object can only cause damage to objects of this target type (provided they're also in an opposing team). See  below for more information.
 *  : Object's height. This doesn't need to be very specific. For reference, leaders are usually 32, Pikmin are usually 24.
 *  : The object's top health. For reference, leaders have 2000, and something like a Red Bulborb has 750.
 *  : Standard movement speed (in pixels per second). For reference, leaders move at 130.
 *  :  if this object can be pushed out of the way by other objects.   otherwise.
 *  :  if this object can push "pushable" objects out of the way.   otherwise.
 *  : The object's size, represented by the circle's radius (in pixels). Leaders are 32 pixels wide, so their radius is 16. Pikmin have a radius of 10.
 *  : How fast the object turns when moving, in degrees per second. For reference, leaders use around 360, Pikmin use around 630, and a Red Bulborb uses around 114.
 *  : What type of "target" the object is. This determines which objects will hunt it, and which objects can attack it. Possible values are as follows, along with what each type is meant to represent:
 * : Cannot be damaged or hunted down.
 * : Leaders, Pikmin, and anything belonging to the "heroes" of the player's side.
 * : Enemies.
 * : Weaker objects that should be damaged by many things, like leaders, Pikmin, or explosions. e.g. egg.
 * : Stronger objects that should be damaged by beefy hits, like Pikmin or explosions. e.g. gas pipe.
 * : An object only Pikmin should harm. e.g. electric gate.
 * : An object that should only be hurt by an explosion. e.g. reinforced wall.
 * : An object that should be hurt by Pikmin or explosives only. e.g. Burgeoning Spiderwort.
 * : A fragile object that should be harmed by even the gentlest smack. e.g. bomb rock.

Optional attributes
For all categories of object type, you may set these attributes, but they will still work if you don't.


 *  : If set to, the object being alive in the way of carrier Pikmin will block their carrying, like a gate or an unbuilt bridge.
 *  : If true, this object can move in any direction freely, without having to first turn there. It will also not face towards the direction it is going.
 *  : If set to, the object won't cast a shadow on the ground. Default is.
 *  : For every source of damage not specified in the vulnerabilities, the damage the object receives is multiplied by this amount.
 *  : Passive health regeneration rate, in HP per second. Default is.
 *  : If set to, the object will be considered an obstacle. This only impacts whether enemies and such can harm it or not.
 *  : If an enemy has taken this much damage, it will be considered "itchy". With this, you can listen to the  event, and when it triggers, make the enemy shake the Pikmin off. Handling this event automatically resets the amount of damage, making it possible for the enemy to be itchy again, next time it takes this amount of damage. Setting this to something like 10% or 20% of the max health is usually the way to go.
 *  : In order for the enemy to not shake over and over, if you keep damaging it, you can also specify a minimum time requirement between itches, in seconds.
 *  : A color to represent the object by. The format is  (values range from 0 to 255). Default is black.
 *  : Maximum number of Pikmin that can carry this object, when it is made carriable.
 *  : If true, this object pushes with its (normal or attack) hitboxes, instead of pushing using its object's center and radius.
 *  : If this object is meant to have rectangular collision, specify the rectangle's dimensions here, in the format . This is useful for objects like gates, but shouldn't be used by objects that can move (among other things, the engine is not ready to handle rectangular object vs rectangular object collisions).
 *  : If set to, the object's health wheel will not appear on top of it. Default is.
 *  : If this object is meant to cause spike damage, specify the spike damage type's name here.
 *  : Normally, objects hit by a spike damage attack will receive the damage specified. If you want this mob type to take more or less damage (or even heal!), you can specify it here. This is a block, where every attribute inside has the spike damage type's name as a name, and the percentage as a value. Example:  will make this enemy take half the intended damage when ingesting a White Pikmin.
 *  : How far away from the spawn point must the enemy be before being considered "far from home". For reference, a Red Bulborb has this set to 500.
 *  : If, this object can be walked on top of by other objects. Other objects will be able to mount it if they fall on it from above, or if they are on a floor that's within 50 units of height from the top of this object (much like how climbing up stairs work).
 *  : How much Pikmin strength does it take to carry the object.

List of object categories
The following is a list of all categories that exist in the engine, with links to pages detailing more information about them.

If there's a type of object you know is popular in the Pikmin series, but you can't find the category for it, then either an appropriate category does not yet exist in the engine, or it can be created as a custom object.

Spawning other objects
If you want your object to spawn other objects, you need to specify their spawn data. In, include a block titled. Inside, you will write a series of blocks, each one with a unique name that will identify that spawn data. Later, when you want to spawn an object using the script, you need to refer to this name.

These spawn data blocks must have the following attributes inside:
 *  : Name of the type of object to be spawned. This is the formal name, i.e. the name provided in the  attribute in the mob type's   file.

It can also optionally have these attributes:
 *  : Are the specified spawn coordinates absolute or relative? See here for more help.
 *  : Coordinates to spawn in, in the format.
 *  : Angle the spawned object will be facing.
 *  : If this is 0, the mob spawns in the exact spot specified and stand there. Otherwise, it will spawn in that spot but be launched in a random direction, with the specified momentum. 100 is a good general case value.
 *  : Any script variables to include, separated by semicolon. Example:.
 *  : If, a link will be created from the spawned object to your object.
 *  : If, a link will be created from your object to the spawned object.

Parent/Child objects
Your object can be a parent object, meaning it is actually composed of several different child objects. This feature is especially useful when you need several independently-moving parts. For instance, in a, the head is the parent object, meaning it is the enemy proper, and each leg is a child object.

A parent will spawn its children at the same time that it itself is spawned. Because every child is meant to be its own individual thing but also serve as components of the parent object, there are several ways for you to specify what it should do when it interacts with the world. This means specifying what happens when it receives damage, receives a script event, or receives a status effect: it can either ignore what it received or not, and it can either relay it to the parent object or not.

Children objects can also be connected to a specific body part in the parent. Because children objects are commonly used as appendages of the creature, it is possible to draw a "limb" connecting a parent object to a child object. This limb is a rectangular shaped sprite that stretches and rotates accordingly.

To make your object type a parent, go to, and add a block called. Inside, you will include a series of blocks, each one with a unique name that represents the child, e.g. "left_foot". Now, when your object is spawned, it will spawn these children along with it. Each of these children blocks needs to have the following attributes:
 *  : Name of the spawn data to use.

The blocks can also have the following optional attributes:
 *  : If, then the parent object is holding this one, much like an enemy holds a Pikmin that is latched on to it. Use the following attributes to specify the location.
 *  : If the parent holds this child, this is the name of the body part it is held on. If empty, the center of the parent object is used instead.
 *  : If the parent holds this child, this is how far away from the center of the body part/object the child is. 0 means dead center, and 1 means on the edge, but you can write numbers beyond this range.
 *  : If the parent holds this child, this is the angle from the body part/object's default position that the child is located at.
 *  : Indicates how the child can rotate.  means it never rotates (besides the starting angle).   means it always rotates to face the center of the parent object.   means it's always the same angle as the parent object. Defaults to never.
 *  : If, the child object loses health when it receives damage. If  , it ignores the damage.
 *  : If, the child object relays any damage to the parent object, so it can handle it.
 *  : If, the child object handles any script event that it receives. If  , it ignores the event.
 *  : If, the child object relays any events received to the parent object, so it can handle them.
 *  : If, the child object handles any status effect that it receives. If  , it ignores the status.
 *  : If, the child object relays any status effects received to the parent object, so it can handle them.
 *  : If there is meant to be a "limb" drawn between the child and parent, specify the name of its animation here. This animation must be included in the parent object's animation set.
 *  : If there is a limb, this specifies how thick it is.
 *  : If there is a limb, this specifies where it connects to in the parent. If it's empty, it connects to the parent's center. Otherwise, it connects to the center of the specified body part.
 *  : If there is a limb, you can specify how far away it is from the center of the parent-side connection.
 *  : Same as, but for the child object.
 *  : Same as, but for the child object.
 *  : How to draw the limb. This can be one of the following:
 * : Draw the limb below both the parent and the child.
 * : Draw the limb below the child. It may appear above or below the parent, depending on the child and parent's positions.
 * : Draw the limb below the parent. It may appear above or below the child, depending on the child and parent's positions.
 * : Draw the limb above the parent. It may appear above or below the child, depending on the child and parent's positions.
 * : Draw the limb above the child. It may appear above or below the parent, depending on the child and parent's positions.
 * : Draw the limb above both the parent and the child.

Vulnerabilities
You can make it so that an object is completely invulnerable to a hazard, more vulnerable to another, etc.

In, add a block titled. Inside, each line will indicate a hazard, and a multiplier, in the format. The hazard is the name of the hazard you want to receive special treatment, and the multiplier is how much the damage will be multiplied by. So for instance, if you want an object to be invulnerable to fire attacks, write a line with, and if you want the object to take double damage to water attacks, write.

You can use this in conjunction with the  attribute to make an object that is invulnerable to anything except explosions, for instance.