feat(gootower): replace sky drawing with background image asset
- Add gootower-bg to asset manifest - Replace drawSky() with drawBackground() method that renders the background texture - Display background when entering play mode
This commit is contained in:
parent
5b24cc3ad0
commit
6e9cc84f6a
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
|
|
@ -61,6 +61,9 @@ const sheet = (key, path, frameWidth, frameHeight) => ({ type: 'spritesheet', ke
|
||||||
const image = (key, path) => ({ type: 'image', key, path });
|
const image = (key, path) => ({ type: 'image', key, path });
|
||||||
|
|
||||||
export const MANIFEST = {
|
export const MANIFEST = {
|
||||||
|
gootower: [
|
||||||
|
image('gootower-bg', 'assets/images/gootower/background-1.png'),
|
||||||
|
],
|
||||||
forbiddenisland: [
|
forbiddenisland: [
|
||||||
// Tiles: 2 cols (dry, flooded) × 24 rows. Row i → dry frame 2i, flooded
|
// Tiles: 2 cols (dry, flooded) × 24 rows. Row i → dry frame 2i, flooded
|
||||||
// frame 2i+1 (see IslandData.TILE_FRAME_ROW).
|
// frame 2i+1 (see IslandData.TILE_FRAME_ROW).
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,6 @@ export default class GooTowerGame extends Phaser.Scene {
|
||||||
if (music?.tracks) new MusicPlayer(this, music.tracks);
|
if (music?.tracks) new MusicPlayer(this, music.tracks);
|
||||||
} catch (_) { /* optional */ }
|
} catch (_) { /* optional */ }
|
||||||
|
|
||||||
this.drawSky();
|
|
||||||
|
|
||||||
const raw = this.cache.json.get('gootower-levels');
|
const raw = this.cache.json.get('gootower-levels');
|
||||||
this.manifest = (raw?.levels ?? []).slice().sort((a, b) => a.level - b.level);
|
this.manifest = (raw?.levels ?? []).slice().sort((a, b) => a.level - b.level);
|
||||||
this.chapters = raw?.chapters?.length
|
this.chapters = raw?.chapters?.length
|
||||||
|
|
@ -139,6 +137,13 @@ export default class GooTowerGame extends Phaser.Scene {
|
||||||
g.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT);
|
g.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawBackground() {
|
||||||
|
if (this.textures.exists('gootower-bg')) {
|
||||||
|
this.add.image(GAME_WIDTH / 2, GAME_HEIGHT / 2, 'gootower-bg')
|
||||||
|
.setDisplaySize(GAME_WIDTH, GAME_HEIGHT).setDepth(D.sky);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clearBoard() {
|
clearBoard() {
|
||||||
for (const o of this.boardObjs) o.destroy();
|
for (const o of this.boardObjs) o.destroy();
|
||||||
this.boardObjs = [];
|
this.boardObjs = [];
|
||||||
|
|
@ -308,6 +313,7 @@ export default class GooTowerGame extends Phaser.Scene {
|
||||||
if (!def) { this.showSelect(); return; }
|
if (!def) { this.showSelect(); return; }
|
||||||
|
|
||||||
this.clearBoard();
|
this.clearBoard();
|
||||||
|
this.drawBackground();
|
||||||
this.viewMode = 'play';
|
this.viewMode = 'play';
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.levelDef = def;
|
this.levelDef = def;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue