Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/BunnyNabbit/celaria-formats/llms.txt

Use this file to discover all available pages before exploring further.

PlayerSpawnPoint marks the lizard spawn — the position and facing direction of the player at the start of a run. Every map needs exactly one PlayerSpawnPoint for the player to know where to begin. It extends Instance and has an instanceId of 2.

Constructor

new PlayerSpawnPoint()
The constructor takes no arguments. It initializes position to [0, 0, 0] and rotation to 0.

Properties

position
[number, number, number]
World-space position of the spawn point, inherited from Instance. Defaults to [0, 0, 0]. Z is the gravity axis, so Z controls how high above the ground the player spawns.
rotation
number
The initial facing direction of the player at spawn, in radians. Defaults to 0, which corresponds to facing along the positive Y axis. Use this to orient the player toward the first objective.

Getters

instanceId
2
Always returns 2. Used during binary serialization to identify this object as a PlayerSpawnPoint.

Example

Adding a spawn point to a map

import { PlayerSpawnPoint, EditableCelariaMap } from "celaria-formats"

const map = new EditableCelariaMap()
map.name = "My Level"

const spawn = new PlayerSpawnPoint()
spawn.position = [0, 0, 2]   // Slightly above the ground (Z is up)
spawn.rotation = 0            // Face along positive Y axis

map.instances.push(spawn)

Rotating the spawn to face a specific direction

import { PlayerSpawnPoint } from "celaria-formats"

const spawn = new PlayerSpawnPoint()
spawn.position = [10, -5, 1]

// Face toward negative X (left)
spawn.rotation = Math.PI / 2

// Face toward negative Y (backward)
// spawn.rotation = Math.PI

Reading a spawn point from a parsed map

import { CelariaMap, PlayerSpawnPoint } from "celaria-formats"
import fs from "node:fs"

const buffer = fs.readFileSync("./myMap.cmap")
const map = CelariaMap.parse(buffer)

const spawn = map.instances.find(instance => instance instanceof PlayerSpawnPoint)
if (spawn) {
  console.log("Spawn position:", spawn.position)
  console.log("Spawn rotation:", spawn.rotation)
}

Instance

Abstract base class that PlayerSpawnPoint extends.

Map objects guide

Overview of all map object types and how to use them.

Block

Rectangular geometry block — the terrain players spawn on.

Types reference

Vector3 and other type definitions.

Build docs developers (and LLMs) love