example: replace enemyR

create character

(same data as evil-invaders/enemyData/enemyR)

https://spritehub-c3a33-default-rtdb.firebaseio.com/characters/enemyR.json

{
  "cagage": 1,
  "hp": 20,
  "interval": -1,
  "name": "spikeA",
  "score": 400,
  "shadowOffsetY": 10,
  "shadowReverse": true,
  "speed": 0.7,
  "texture": [
    "spikeC0.png"
  ]
}

create atlas

https://spritehub-6b5678a84bc8.herokuapp.com/sprites.html

select sprites, then “Pack Selected”

enter Atlas Key i.e. "enemyr_atlas” and “Save Atlas to Firebase”

update character

update texture[] and textureKey

{
  "cagage": 1,
  "hp": 20,
  "interval": -1,
  "name": "spikeA",
  "score": 400,
  "shadowOffsetY": 10,
  "shadowReverse": true,
  "speed": 0.7,
  "texture": [
    "v2-spikeC_0",
    "v2-spikeC_1",
    "v2-spikeC_2",
    "v2-spikeC_3"
  ],
  "textureKey": "enemyr_atlas"
}

augment enemyData

const app = initializeApp(firebaseConfig);
const db = getDatabase(app);

try {
    // First, fetch the character data
        const characterRef = ref(db, "characters/enemyR");
        const characterSnapshot = await get(characterRef);

        if (characterSnapshot.exists()) {
            // Assign the character data to enemyR
            PROPERTIES.resource.recipe.data.enemyData.enemyR = characterSnapshot.val();
        } else {
            console.log("Character data not found");
        }

        // Second, fetch the enemy atlas
        const atlasRef = ref(db, "atlases/enemyr_atlas");
        const atlasSnapshot = await get(atlasRef);

        if (atlasSnapshot.exists()) {
            const atlasData = atlasSnapshot.val();

            try {
                // Create and load the image properly before using it
                const jsonData = JSON.parse(atlasData.json);
                const imageObj = await this.createImageFromBase64(atlasData.png);

                // Now that the image is loaded, add it to the texture manager
                this.textures.addAtlas("enemyr_atlas", imageObj, jsonData);
                console.log("enemyr_atlas loaded successfully!");
            } catch (imgErr) {
                console.error("Error loading enemyr_atlas image:", imgErr);
            }
        } else {
            console.log("enemyr_atlas data not found");
        }
}

example: override Player

(same data as evil-invaders/playerData)

https://spritehub-c3a33-default-rtdb.firebaseio.com/characters/dukeNukem.json