Bug fixes: Disabled missing Tiled map loading && Added safety checks for zombie_walk texture

This commit is contained in:
2025-12-22 12:05:27 +01:00
parent c1cf6b8f48
commit 7ced4b86e9

View File

@@ -31,10 +31,10 @@ class PreloadScene extends Phaser.Scene {
this.load.image('tileset_dirt', 'assets/tilesets/dirt.png'); this.load.image('tileset_dirt', 'assets/tilesets/dirt.png');
this.load.image('tileset_decorations', 'assets/tilesets/decorations.png'); this.load.image('tileset_decorations', 'assets/tilesets/decorations.png');
// 🗺️ TILED MAP (JSON export from Tiled Editor) // 🗺️ TILED MAP (JSON export from Tiled Editor) - DISABLED (files removed)
this.load.tilemapTiledJSON('farm_map', 'assets/maps/farm_map.json'); // this.load.tilemapTiledJSON('farm_map', 'assets/maps/farm_map.json');
this.load.tilemapTiledJSON('micro_farm_128x128', 'assets/maps/micro_farm_128x128.json'); // 🌾 Testna farma // this.load.tilemapTiledJSON('micro_farm_128x128', 'assets/maps/micro_farm_128x128.json'); // 🌾 Testna farma
this.load.tilemapTiledJSON('micro_farm_8x8', 'assets/maps/micro_farm_8x8.json'); // 🏕️ Manjša test mapa // this.load.tilemapTiledJSON('micro_farm_8x8', 'assets/maps/micro_farm_8x8.json'); // 🏕️ Manjša test mapa
this.load.image('grass_tileset_img', 'assets/tilesets/grass.png'); this.load.image('grass_tileset_img', 'assets/tilesets/grass.png');
this.load.image('water_tileset_img', 'assets/tilesets/water.png'); this.load.image('water_tileset_img', 'assets/tilesets/water.png');
this.load.image('decorations_tileset_img', 'assets/tilesets/decorations.png'); this.load.image('decorations_tileset_img', 'assets/tilesets/decorations.png');
@@ -386,13 +386,17 @@ class PreloadScene extends Phaser.Scene {
createAnimations() { createAnimations() {
if (this.anims.exists('protagonist_walk')) return; if (this.anims.exists('protagonist_walk')) return;
// Zombie animations // Zombie animations (only if texture exists)
this.anims.create({ if (this.textures.exists('zombie_walk')) {
key: 'zombie_walk_anim', this.anims.create({
frames: this.anims.generateFrameNumbers('zombie_walk', { start: 0, end: 5 }), key: 'zombie_walk_anim',
frameRate: 8, frames: this.anims.generateFrameNumbers('zombie_walk', { start: 0, end: 5 }),
repeat: -1 frameRate: 8,
}); repeat: -1
});
} else {
console.warn('⚠️ Texture "zombie_walk" not found - skipping animation');
}
this.anims.create({ this.anims.create({
key: 'zombie_worker_walk', key: 'zombie_worker_walk',