Rename sprite enum

This commit is contained in:
Idrees Hassan
2025-10-26 18:33:38 -04:00
parent 2c0e9018eb
commit d623abee85
4 changed files with 133 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
import { Directions } from './shared.js';
import { SPRITE, BirdType } from './sprites.js';
import { Sprite, BirdType } from './sprites.js';
import Layer from './layer.js';
class Frame {
@@ -25,7 +25,7 @@ class Frame {
this.pixels = layers[0].pixels.map(row => row.slice());
// Pad from top with transparent pixels
while (this.pixels.length < maxHeight) {
this.pixels.unshift(new Array(this.pixels[0].length).fill(SPRITE.TRANSPARENT));
this.pixels.unshift(new Array(this.pixels[0].length).fill(Sprite.TRANSPARENT));
}
// Combine layers
for (let i = 1; i < layers.length; i++) {
@@ -34,7 +34,7 @@ class Frame {
let topMargin = maxHeight - layerPixels.length;
for (let y = 0; y < layerPixels.length; y++) {
for (let x = 0; x < layerPixels[y].length; x++) {
this.pixels[y + topMargin][x] = layerPixels[y][x] !== SPRITE.TRANSPARENT ? layerPixels[y][x] : this.pixels[y + topMargin][x];
this.pixels[y + topMargin][x] = layerPixels[y][x] !== Sprite.TRANSPARENT ? layerPixels[y][x] : this.pixels[y + topMargin][x];
}
}
}