Codename Logo Codename Logo

Creating Stages

APIWiki

Creating Stages

Stages are defined via XML files, similar to Creating characters. By creating an XML file in ./data/stages, you officially created a stage.

The default stage XML looks something like this:

<stage zoom="0.9" name="stage" folder="stages/default/" startCamPosY="600" startCamPosX="1000">
    <sprite name="bg" x="-600" y="-200" sprite="stageback" scroll="0.9"/>
    <sprite name="stageFront" x="-600" y="600" sprite="stagefront" scroll="0.9"/>
    <girlfriend/>
    <dad/>
    <boyfriend/>
    <sprite name="stageCurtains" x="-500" y="-300" sprite="stagecurtains" scroll="1.3"/>
</stage>

There's a lot to pack but we will explain what's going on here.

First, to start with the "parent node", which is the <stage> node, that is where stage options are being defined.

<stage zoom="0.9" name="stage" folder="stages/default/" startCamPosY="600" startCamPosX="1000">

Noting options that you can set there:

As for the other nodes, there's about 7 types of them (and more if you script them in, see Character/Stage Scripts), we'll go through each of them.

(note that it's important which order you put them in because they will take the same order in-game too)

Sprite node (<sprite>, <spr>, <sparrow>)

The sprite node defines the basic sprites in a stage.

<sprite name="bg" x="-600" y="-200" sprite="stageback" scroll="0.9"/>

The options are:

Other options include:

You can also define animations by giving it a child node called <anim>. A sprite node with an animation node looks something like this:

<sprite name="dancer1" sprite="limoDancer" type="onbeat">
    <anim name="danceLeft" anim="bg dancer sketch PINK" loop="false"/>
    <anim name="danceRight" anim="bg dancer sketch PINK" loop="false"/>
</sprite>

An <anim> node can define these options:

Defining advanced properties is also possible. Like this:

<sprite name="clouds" sprite="clouds">
    <property name="moves" type="bool" value="true">
    <property name="velocity.x" type="float" value="40.0">
</sprite>

Solid node (<solid>, <box>)

Solid nodes are sprites that is, unlike a Sprite Node, composed of only one select color. This node has less parameters since it doesn't use images.
Creating one of these looks something like this:

<solid name="void" color="#FFFFFF" width="1280" height="720">

(there's a difference between using <solid> and <box>, while <solid> offers more performance, it might break with shaders and other stuff, so if that happens, use <box> instead)

Accepted parameters:

Character nodes (<boyfriend>, <bf>, <player>, <girlfriend>, <gf>, <dad>, <opponent>, <character>, <char>)

Character nodes are used to position characters in the stage. A Character node looks something like this:

<boyfriend x="200" y="400"/>

Accepted parameters are:

For the <character> and <char> nodes only use them if you want to change a specific character (ex. if you want to change pico's positions)

<character name="pico" x="400" y="200">

Keep in mind that where you put these nodes is important as the character will be layered depending on that.

<boyfriend/>
<sprite name="stageCurtains" x="-500" y="-300" sprite="stagecurtains" scroll="1.3"/>

(this will put boyfriend behind the stageCurtains sprite)

Ratings sprites node (<ratings>, <combo>)

This node is only used to position the rating sprites and does nothing else (atm). Positioning in nodes doesn't matter here.

<ratings x="200" y="400">

The only parameters are x and y.

Stage Extensions (<use-extension>, <extension>, <ext>)

<use-extension script="example" />
<extension script="example" />
<ext script="example" />

<ext script="example" folder="data/scripts/" isShortLived="true" importStageSprites="true" loadBefore="false" />

Accepted parameters:

All of these attributes above get stored inside a list, singular Imported XML scripts can access their infos easily through a variable called scriptInfo (this variable uses a XMLImportedScriptInfo class and it's automatically imported into these scripts).

This allows you to load custom scripts for your stages, that allow for adding custom stage nodes, or whatever else you can think of.

Check out the Stage Extensions page for more information.

Written by: Frakits & Ne_Eo & Nex_isDumb
Last updated: 2024-09-20