Skip to content

06 Note Segments

In this chapter, we will implement note segments.

Segments

Project templates come with empty example segments, we can rename them to note segments.

Each segment exports an object that may optionally have enter, update, exit methods which will be called at appropriate times.

Intro segment simply shows and clears the overlay.

TypeScript
export const noteIntro = {
    enter() {
        noteDisplay.showOverlay()
    },

    exit() {
        noteDisplay.clear()
    },
}
JavaScript
export const noteIntro = {
    enter() {
        noteDisplay.showOverlay()
    },

    exit() {
        noteDisplay.clear()
    },
}

And similarly for fall and frozen segments:

TypeScript
export const noteFall = {
    enter() {
        noteDisplay.showFall()
    },

    exit() {
        noteDisplay.clear()
    },
}
JavaScript
export const noteFall = {
    enter() {
        noteDisplay.showFall()
    },

    exit() {
        noteDisplay.clear()
    },
}
TypeScript
export const noteFrozen = {
    enter() {
        noteDisplay.showFrozen()
    },

    exit() {
        noteDisplay.clear()
    },
}
JavaScript
export const noteFrozen = {
    enter() {
        noteDisplay.showFrozen()
    },

    exit() {
        noteDisplay.clear()
    },
}

For now, hit segment is empty:

TypeScript
export const noteHit = {}
JavaScript
export const noteHit = {}