Skip to content

04 Stage

In this chapter, we will implement Stage.

Lifetime

Stage should always be active, and a simple way to achieve that is to return large values in spawnTime and despawnTime:

TypeScript
export class Stage extends Archetype {
    spawnTime() {
        return -999999
    }

    despawnTime() {
        return 999999
    }

    // ...
}
JavaScript
export class Stage extends Archetype {
    spawnTime() {
        return -999999
    }

    despawnTime() {
        return 999999
    }

    // ...
}

Declaring

We need to declare skin sprites :

TypeScript
export const skin = defineSkin({
    sprites: {
        judgeLine: SkinSpriteName.JudgmentLine,
    },
})
JavaScript
export const skin = defineSkin({
    sprites: {
        judgeLine: SkinSpriteName.JudgmentLine,
    },
})

Drawing

Drawing of stage is similar to play mode:

TypeScript
export class Stage extends Archetype {
    // ...

    updateParallel() {
        const layout = new Rect({
            l: judgeLine.l,
            r: judgeLine.r,
            t: 1 - note.radius / 4,
            b: 1 + note.radius / 4,
        })

        skin.sprites.judgeLine.draw(layout, 0, 1)
    }
}
JavaScript
export class Stage extends Archetype {
    // ...

    updateParallel() {
        const layout = new Rect({
            l: judgeLine.l,
            r: judgeLine.r,
            t: 1 - note.radius / 4,
            b: 1 + note.radius / 4,
        })

        skin.sprites.judgeLine.draw(layout, 0, 1)
    }
}