managarten/games/whopixels/js/scenes/GameScene.js
Till JS 8511c2ca4c feat(cd): add Matrix notification on deploy failure
Sends a message to a Matrix room when a deploy fails, including
the failing services, commit, deployer, and a link to the logs.

Requires two GitHub Actions secrets:
- DEPLOY_NOTIFY_ROOM_ID: Matrix room ID
- DEPLOY_NOTIFY_BOT_TOKEN: Matrix bot access token

Skips silently if secrets are not configured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 19:47:53 +01:00

113 lines
2.4 KiB
JavaScript

class GameScene extends Phaser.Scene {
constructor() {
super({ key: 'GameScene' });
}
create() {
// Add background
this.add.image(400, 300, 'background');
// Create grid for pixel art (16x16 grid of 32x32 pixel tiles)
this.grid = [];
this.tileSize = 32;
this.gridWidth = 16;
this.gridHeight = 16;
this.gridStartX = (800 - this.gridWidth * this.tileSize) / 2;
this.gridStartY = (600 - this.gridHeight * this.tileSize) / 2;
// Create grid of tiles
for (let y = 0; y < this.gridHeight; y++) {
this.grid[y] = [];
for (let x = 0; x < this.gridWidth; x++) {
const tile = this.add.image(
this.gridStartX + x * this.tileSize + this.tileSize / 2,
this.gridStartY + y * this.tileSize + this.tileSize / 2,
'tile'
);
tile.setTint(0xffffff); // Default white color
tile.setInteractive();
tile.on('pointerdown', () => {
this.paintTile(x, y);
});
this.grid[y][x] = tile;
}
}
// Current selected color (default: black)
this.currentColor = 0x000000;
// Create color palette
this.createColorPalette();
// Add UI text
this.add
.text(400, 50, 'Pixel Editor', {
fontSize: '32px',
fill: '#fff',
})
.setOrigin(0.5);
// Add back button
const backButton = this.add
.text(100, 50, 'Zurück', {
fontSize: '24px',
fill: '#fff',
backgroundColor: '#4a4a4a',
padding: { x: 10, y: 5 },
})
.setOrigin(0.5)
.setInteractive();
backButton.on('pointerover', () => {
backButton.setStyle({ fill: '#ff0' });
});
backButton.on('pointerout', () => {
backButton.setStyle({ fill: '#fff' });
});
backButton.on('pointerdown', () => {
this.scene.start('MainMenuScene');
});
}
createColorPalette() {
const colors = [
0x000000, // Black
0xffffff, // White
0xff0000, // Red
0x00ff00, // Green
0x0000ff, // Blue
0xffff00, // Yellow
0xff00ff, // Magenta
0x00ffff, // Cyan
];
const paletteX = 700;
const paletteY = 150;
const paletteSize = 30;
const paletteGap = 10;
colors.forEach((color, index) => {
const colorButton = this.add.rectangle(
paletteX,
paletteY + index * (paletteSize + paletteGap),
paletteSize,
paletteSize,
color
);
colorButton.setInteractive();
colorButton.on('pointerdown', () => {
this.currentColor = color;
});
// Add stroke around the button
colorButton.setStrokeStyle(2, 0xffffff);
});
}
paintTile(x, y) {
this.grid[y][x].setTint(this.currentColor);
}
}