mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 04:07:23 +00:00
Rename sprite part constants
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Directions } from './sharedConstants.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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user