mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Remove decoration code
This commit is contained in:
39
src/birb.js
39
src/birb.js
@@ -87,11 +87,9 @@ const DEFAULT_BIRD = "bluebird";
|
||||
|
||||
const SPRITE_WIDTH = 32;
|
||||
const SPRITE_HEIGHT = 32;
|
||||
const DECORATIONS_SPRITE_WIDTH = 48;
|
||||
const FEATHER_SPRITE_WIDTH = 32;
|
||||
|
||||
const SPRITE_SHEET = "__SPRITE_SHEET__";
|
||||
const DECORATIONS_SPRITE_SHEET = "__DECORATIONS_SPRITE_SHEET__";
|
||||
const FEATHER_SPRITE_SHEET = "__FEATHER_SPRITE_SHEET__";
|
||||
|
||||
const FIELD_GUIDE_ID = "birb-field-guide";
|
||||
@@ -180,12 +178,10 @@ log("Loading sprite sheets...");
|
||||
|
||||
Promise.all([
|
||||
loadSpriteSheetPixels(SPRITE_SHEET),
|
||||
loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false),
|
||||
loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)
|
||||
]).then(([birbPixels, decorationPixels, featherPixels]) => {
|
||||
]).then(([birbPixels, featherPixels]) => {
|
||||
|
||||
const SPRITE_SHEET = birbPixels;
|
||||
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
||||
const FEATHER_SPRITE_SHEET = featherPixels;
|
||||
|
||||
const layers = {
|
||||
@@ -201,10 +197,6 @@ Promise.all([
|
||||
happyEye: new Layer(getLayer(SPRITE_SHEET, 9)),
|
||||
};
|
||||
|
||||
const decorationLayers = {
|
||||
mac: new Layer(getLayer(DECORATIONS_SPRITE_SHEET, 0, DECORATIONS_SPRITE_WIDTH)),
|
||||
};
|
||||
|
||||
const featherLayers = {
|
||||
feather: new Layer(getLayer(FEATHER_SPRITE_SHEET, 0, FEATHER_SPRITE_WIDTH)),
|
||||
};
|
||||
@@ -220,10 +212,6 @@ Promise.all([
|
||||
heartFour: new Frame([layers.base, layers.tuftBase, layers.happyEye, layers.heartTwo]),
|
||||
};
|
||||
|
||||
const decorationFrames = {
|
||||
mac: new Frame([decorationLayers.mac]),
|
||||
};
|
||||
|
||||
const featherFrames = {
|
||||
feather: new Frame([featherLayers.feather]),
|
||||
};
|
||||
@@ -269,14 +257,6 @@ Promise.all([
|
||||
], false),
|
||||
};
|
||||
|
||||
const DECORATION_ANIMATIONS = {
|
||||
mac: new Anim([
|
||||
decorationFrames.mac,
|
||||
], [
|
||||
1000,
|
||||
]),
|
||||
};
|
||||
|
||||
const FEATHER_ANIMATIONS = {
|
||||
feather: new Anim([
|
||||
featherFrames.feather,
|
||||
@@ -681,23 +661,6 @@ Promise.all([
|
||||
return window;
|
||||
}
|
||||
|
||||
function insertDecoration() {
|
||||
// Create a canvas element for the decoration
|
||||
const decorationCanvas = document.createElement("canvas");
|
||||
decorationCanvas.classList.add("birb-decoration");
|
||||
decorationCanvas.width = DECORATIONS_SPRITE_WIDTH * CANVAS_PIXEL_SIZE;
|
||||
decorationCanvas.height = DECORATIONS_SPRITE_WIDTH * CANVAS_PIXEL_SIZE;
|
||||
const decorationCtx = decorationCanvas.getContext("2d");
|
||||
if (!decorationCtx) {
|
||||
return;
|
||||
}
|
||||
// Draw the decoration
|
||||
DECORATION_ANIMATIONS.mac.draw(decorationCtx, Directions.LEFT, CANVAS_PIXEL_SIZE, Date.now());
|
||||
// Add the decoration to the page
|
||||
document.body.appendChild(decorationCanvas);
|
||||
makeDraggable(decorationCanvas, false);
|
||||
}
|
||||
|
||||
function activateFeather() {
|
||||
if (document.querySelector("#" + FEATHER_ID)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user