feat(worms): add background image to mode selection screen

Add optional background image to the worms game mode select screen.
The image is loaded via asset manifest and displayed behind UI elements.
Reposition buttons to accommodate the new background layout.
This commit is contained in:
Brian Fertig 2026-07-31 18:06:39 -06:00
parent 2268c74918
commit 95b200022c
3 changed files with 9 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -89,6 +89,7 @@ export const MANIFEST = {
// All of Worms' art is optional drop-in theme art; the game is fully // All of Worms' art is optional drop-in theme art; the game is fully
// playable with none of it (see data/worms-artwork.json). // playable with none of it (see data/worms-artwork.json).
worms: [ worms: [
image('worms-bg-menu', 'assets/images/worms/background-menu.png'),
(scene) => wormsArt(scene), (scene) => wormsArt(scene),
], ],
gootower: [ gootower: [

View File

@ -96,19 +96,21 @@ export default class WormsGame extends Phaser.Scene {
showModeSelect() { showModeSelect() {
this.clearScreen(); this.clearScreen();
this.cameras.main.setScroll(0, 0).setZoom(1).setBounds(0, 0, GAME_WIDTH, GAME_HEIGHT); this.cameras.main.setScroll(0, 0).setZoom(1).setBounds(0, 0, GAME_WIDTH, GAME_HEIGHT);
this.title('WORMS', 150, 96);
this.track(this.add.text(GAME_WIDTH / 2, 232, 'Total annihilation, one turn at a time.', { // Background image (if loaded).
fontFamily: FONT, fontSize: '30px', color: COLORS.mutedHex, if (this.textures.exists('worms-bg-menu')) {
}).setOrigin(0.5).setScrollFactor(0).setDepth(100)); this.track(this.add.image(GAME_WIDTH / 2, GAME_HEIGHT / 2, 'worms-bg-menu')
.setDisplaySize(GAME_WIDTH, GAME_HEIGHT).setDepth(-1));
}
MODES.forEach((m, i) => { MODES.forEach((m, i) => {
this.track(new Button(this, GAME_WIDTH / 2, 400 + i * 96, m.label, () => { this.track(new Button(this, GAME_WIDTH / 2, 800 + i * 96, m.label, () => {
this.mode = m.id; this.mode = m.id;
this.showSetup(); this.showSetup();
}, { width: 560, height: 72 })); }, { width: 560, height: 72 }));
}); });
this.track(new Button(this, GAME_WIDTH / 2, 720, 'Leave', () => { this.track(new Button(this, GAME_WIDTH / 2, 1020, 'Leave', () => {
this.scene.start('GameMenu'); this.scene.start('GameMenu');
}, { width: 260, height: 60 })); }, { width: 260, height: 60 }));