feat(tetris-attack): add character background sprites
Add new background images for Klaxon, Steve, and Victor characters with 5 animation states each (r1-r5). fix(civilization): resolve hotkey capture in city naming modal Store hotkey list in this.hotkeyList to properly clear and restore keyboard captures when opening/closing the city name input modal. Previously, gameplay hotkeys prevented typing in the input field.
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 669 KiB After Width: | Height: | Size: 1.2 MiB |
|
|
@ -84,7 +84,8 @@ export default class CivilizationGame extends Phaser.Scene {
|
||||||
this.setupRoot = null;
|
this.setupRoot = null;
|
||||||
this.toasts = [];
|
this.toasts = [];
|
||||||
|
|
||||||
this.keys = this.input.keyboard.addKeys('UP,DOWN,LEFT,RIGHT,Q,E,Z,C,W,A,S,D,B,F,G,I,M,N,O,R,T,SPACE,ENTER');
|
this.hotkeyList = 'UP,DOWN,LEFT,RIGHT,Q,E,Z,C,W,A,S,D,B,F,G,I,M,N,O,R,T,SPACE,ENTER';
|
||||||
|
this.keys = this.input.keyboard.addKeys(this.hotkeyList);
|
||||||
this.escHandler = () => this.onEscape();
|
this.escHandler = () => this.onEscape();
|
||||||
this.input.keyboard.on('keydown-ESC', this.escHandler);
|
this.input.keyboard.on('keydown-ESC', this.escHandler);
|
||||||
this.events.once('shutdown', () => {
|
this.events.once('shutdown', () => {
|
||||||
|
|
@ -966,6 +967,9 @@ export default class CivilizationGame extends Phaser.Scene {
|
||||||
|
|
||||||
promptCityName(defaultName, onConfirm) {
|
promptCityName(defaultName, onConfirm) {
|
||||||
this.modalOpen = true;
|
this.modalOpen = true;
|
||||||
|
// Gameplay hotkeys capture (preventDefault) these keys at the window level,
|
||||||
|
// which blocks the browser from typing them into the name field below.
|
||||||
|
this.input.keyboard.clearCaptures();
|
||||||
const cx = GAME_WIDTH / 2;
|
const cx = GAME_WIDTH / 2;
|
||||||
const cy = GAME_HEIGHT / 2;
|
const cy = GAME_HEIGHT / 2;
|
||||||
const root = this.add.container(0, 0).setDepth(D.modal);
|
const root = this.add.container(0, 0).setDepth(D.modal);
|
||||||
|
|
@ -985,7 +989,10 @@ export default class CivilizationGame extends Phaser.Scene {
|
||||||
input.focus();
|
input.focus();
|
||||||
input.el.select();
|
input.el.select();
|
||||||
|
|
||||||
const close = () => { input.destroy(); root.destroy(true); this.modalOpen = false; };
|
const close = () => {
|
||||||
|
input.destroy(); root.destroy(true); this.modalOpen = false;
|
||||||
|
this.input.keyboard.addCapture(this.hotkeyList);
|
||||||
|
};
|
||||||
const confirm = () => {
|
const confirm = () => {
|
||||||
const name = input.value.trim() || defaultName;
|
const name = input.value.trim() || defaultName;
|
||||||
close();
|
close();
|
||||||
|
|
|
||||||