// Preload Scene - Nalaganje assetov class PreloadScene extends Phaser.Scene { constructor() { super({ key: 'PreloadScene' }); } preload() { console.log('โณ PreloadScene: Loading assets...'); this.createLoadingBar(); // Load ALL custom sprites this.load.image('player_sprite', 'assets/player_sprite.png'); this.load.image('zombie_sprite', 'assets/zombie_sprite.png'); this.load.image('merchant_sprite', 'assets/merchant_sprite.png'); this.load.image('house_sprite', 'assets/house_sprite.png'); this.load.image('stone_sprite', 'assets/stone_sprite.png'); this.load.image('tree_sprite', 'assets/tree_sprite.png'); this.load.image('grass_sprite', 'assets/grass_sprite.png'); this.load.image('grass_tile', 'assets/grass_tile.png'); this.load.image('leaf_sprite', 'assets/leaf_sprite.png'); this.load.image('wheat_sprite', 'assets/wheat_sprite.png'); this.load.image('stone_texture', 'assets/stone_texture.png'); // ๐Ÿ’ง WEATHER EFFECTS this.load.image('luza_sprite', 'assets/sprites/luza.png'); // Puddle sprite // ๐ŸŽจ 2D TILESET IMAGES (Stardew Valley Style) this.load.image('tileset_grass', 'assets/tilesets/grass.png'); this.load.image('tileset_water', 'assets/tilesets/water.png'); this.load.image('tileset_dirt', 'assets/tilesets/dirt.png'); this.load.image('tileset_decorations', 'assets/tilesets/decorations.png'); // ๐Ÿ—บ๏ธ TILED MAP (JSON export from Tiled Editor) 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.image('grass_tileset_img', 'assets/tilesets/grass.png'); this.load.image('water_tileset_img', 'assets/tilesets/water.png'); this.load.image('decorations_tileset_img', 'assets/tilesets/decorations.png'); // New asset packs this.load.image('objects_pack', 'assets/objects_pack.png'); this.load.image('walls_pack', 'assets/walls_pack.png'); this.load.image('ground_tiles', 'assets/ground_tiles.png'); this.load.image('objects_pack2', 'assets/objects_pack2.png'); this.load.image('trees_vegetation', 'assets/trees_vegetation.png'); // User-uploaded pixel art assets (original) this.load.image('flowers', 'assets/flowers.png'); this.load.image('tree_green', 'assets/tree_green.png'); this.load.image('tree_blue', 'assets/tree_blue.png'); this.load.image('tree_dead', 'assets/tree_dead.png'); this.load.image('rock_asset', 'assets/rock_asset.png'); // FINAL TREES (User Uploaded) this.load.image('tree_green_final', 'assets/tree_green_final.png'); this.load.image('tree_blue_final', 'assets/tree_blue_final.png'); this.load.image('tree_dead_final', 'assets/tree_dead_final.png'); // ๐ŸŒณ TREE VARIETY SPRITES (GREEN SCREEN!) this.load.image('tree_cherry', 'assets/sprites/tree_cherry.png'); this.load.image('tree_oak', 'assets/sprites/tree_oak.png'); this.load.image('tree_pine', 'assets/sprites/tree_pine.png'); this.load.image('tree_dead', 'assets/sprites/tree_dead.png'); this.load.image('tree_apple', 'assets/sprites/tree_apple.png'); // STARDEW VALLEY FOREST TREES (NEW!) this.load.image('tree_purple', 'assets/tree_purple.png'); this.load.image('tree_apple', 'assets/tree_apple.png'); this.load.image('tree_pear', 'assets/tree_pear.png'); this.load.image('tree_cherry', 'assets/tree_cherry.png'); this.load.image('tree_sapling', 'assets/tree_green_final.png'); // Reuse green as sapling // NEW transparent tree/rock assets this.load.image('tree_blue_new', 'assets/tree_blue_new.png'); // Keep for backup this.load.image('tree_green_new', 'assets/tree_green_new.png'); this.load.image('rock_1', 'assets/rock_1.png'); this.load.image('rock_2', 'assets/rock_2.png'); this.load.image('rock_small', 'assets/rock_small.png'); this.load.image('tree_dead_new', 'assets/tree_dead_new.png'); this.load.image('flowers_new', 'assets/flowers_new.png'); this.load.image('merchant_new', 'assets/merchant_new.png'); this.load.image('elite_zombie', 'assets/elite_zombie.png'); // Fence old for abandoned houses this.load.image('fence_old', 'assets/fence_isometric.png'); // Reuse fence for old houses // AI-Generated NPC Sprites (with cache-busting) const cacheBust = Date.now(); this.load.image('cow', `assets/cow.png?v=${cacheBust}`); this.load.image('chicken', `assets/chicken.png?v=${cacheBust}`); this.load.image('troll', `assets/troll.png?v=${cacheBust}`); this.load.image('elf', `assets/elf.png?v=${cacheBust}`); this.load.image('villager', `assets/villager.png?v=${cacheBust}`); this.load.image('cow_mutant', `assets/cow_mutant.png?v=${cacheBust}`); this.load.image('hill_sprite', 'assets/hill_sprite.png'); this.load.image('fence', 'assets/fence.png'); this.load.image('gravestone', 'assets/gravestone.png'); // City content assets this.load.image('chest', 'assets/chest.png'); this.load.image('spawner', 'assets/spawner.png'); this.load.image('signpost_city', 'assets/signpost_city.png'); this.load.image('signpost_farm', 'assets/signpost_farm.png'); this.load.image('signpost_both', 'assets/signpost_both.png'); this.load.image('city_wall', 'assets/city_wall.png'); this.load.image('road_tile', 'assets/road_tile.png'); this.load.image('farm_zone', 'assets/farm_zone.png'); this.load.image('fence_full', 'assets/fence_full.png'); this.load.image('wall_damaged', 'assets/wall_damaged.png'); // Voxel stil asset-i (2.5D) this.load.image('tree_voxel_green', 'assets/tree_voxel_green.png'); this.load.image('tree_voxel_blue', 'assets/tree_voxel_blue.png'); this.load.image('tree_voxel_dead', 'assets/tree_voxel_dead.png'); this.load.image('rock_voxel', 'assets/rock_voxel.png'); // NEW ISOMETRIC 2.5D ASSETS (Stardew Valley style) // Buildings & Structures this.load.image('barn_isometric', 'assets/barn_isometric.png'); this.load.image('farmhouse_isometric', 'assets/farmhouse_isometric.png'); this.load.image('fence_isometric', 'assets/fence_isometric.png'); this.load.image('bridge_isometric', 'assets/bridge_isometric.png'); this.load.image('blacksmith_workshop', 'assets/blacksmith_workshop.png'); this.load.image('ruins_building', 'assets/ruins_building.png'); // Farm & Crops this.load.image('soil_tilled', 'assets/soil_tilled.png'); this.load.image('carrots_stages', 'assets/carrots_stages.png'); this.load.image('flowers_pink_isometric', 'assets/flowers_pink_isometric.png'); // Characters - SPRITESHEETS (6 frames @ 64x64 each) this.load.spritesheet('player_dreadlocks', 'assets/player_dreadlocks.png', { frameWidth: 64, frameHeight: 64 }); this.load.spritesheet('zombie_worker', 'assets/zombie_worker.png', { frameWidth: 64, frameHeight: 64 }); this.load.image('grave_zombie', 'assets/grave_zombie.png'); // Fence pieces (separate parts) this.load.image('fence_post', 'assets/fence_post.png'); this.load.image('fence_horizontal', 'assets/fence_horizontal.png'); this.load.image('fence_vertical', 'assets/fence_vertical.png'); this.load.image('fence_corner', 'assets/fence_corner.png'); // Water frames are generated procedurally in TerrainSystem.createWaterFrames() // No need to load external files // Wait for load completion then process transparency this.load.once('complete', () => { // NOTE: Do NOT process spritesheets - they already have proper alpha! // Processing destroys frame definitions // ๐Ÿšซ DISABLED - Tree sprites already have transparency! // this.processAllTransparency(); this.createAnimations(); }); // New Processed Animations (Standardized 64x64 strips) // NOTE: zombie_walk_strip.png is missing - commented out for now // this.load.spritesheet('zombie_walk', 'assets/sprites/zombie_walk_strip.png', { frameWidth: 64, frameHeight: 64 }); // KRVAVA ลฝETEV - CLEAN Player Sprite (100% Clean Transparency - No Checkerboard!) this.load.spritesheet('player_protagonist', 'assets/sprites/player_walking_clean.png', { frameWidth: 256, // 256x256 per frame, 4x4 grid = 16 frames (1024x1024 total) frameHeight: 256 }); // โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• // ๐ŸŽฎ KRVAVA ลฝETEV - 2D ASSET LIBRARY (122+ Sprite Sheets) // โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• const kzPath = 'assets/sprites/krvava_zetev/'; // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐ŸŽญ CHARACTERS & NPCs (5 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.spritesheet('kai_player', kzPath + 'kai_player_character_1766065727803.png', { frameWidth: 192, frameHeight: 192 }); this.load.spritesheet('player_char_sheet', kzPath + 'player_character_sheet_1766064600305.png', { frameWidth: 192, frameHeight: 192 }); this.load.image('ivan_blacksmith', kzPath + 'ivan_blacksmith_npc_1766065771497.png'); this.load.image('post_apoc_npcs', kzPath + 'post_apocalyptic_npcs_1766070148258.png'); this.load.image('npcs_complete', kzPath + 'npcs_complete_pack_1766068946290.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐ŸงŸ ENEMIES (6 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.spritesheet('zombie_sheet', kzPath + 'zombie_sprite_sheet_1766064394510.png', { frameWidth: 192, frameHeight: 192 }); this.load.image('zombie_dreadlocks', kzPath + 'zombie_dreadlocks_variants_1766066165782.png'); this.load.image('zombie_workers', kzPath + 'zombie_workers_pack_1766065800851.png'); this.load.spritesheet('mutated_animals', kzPath + 'mutated_animals_sheet_1766064623683.png', { frameWidth: 192, frameHeight: 192 }); this.load.image('mutant_animals_pack', kzPath + 'mutant_animals_pack_1766066209780.png'); this.load.image('mutant_animals_detailed', kzPath + 'mutant_animals_detailed_1766067041989.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿ‘‘ BOSSES (5 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('giant_troll_king', kzPath + 'giant_troll_king_boss_1766068374658.png'); this.load.image('biome_mini_bosses', kzPath + 'biome_mini_bosses_1766070984545.png'); this.load.image('zmaj_volk', kzPath + 'zmaj_volk_boss_1766066495366.png'); this.load.image('mesojedke_boss', kzPath + 'mesojedke_carnivorous_plant_1766066436640.png'); this.load.image('grok_pink_troll', kzPath + 'grok_pink_troll_1766065746545.png'); this.load.image('werewolf_moon', kzPath + 'werewolf_full_moon_1766073073376.png'); this.load.image('slime_creatures', kzPath + 'living_slime_creatures_1766073182543.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿพ ANIMALS & BREEDING (12 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('farm_animals_normal', kzPath + 'farm_animals_normal_1766066190391.png'); this.load.image('farm_animals_detailed', kzPath + 'farm_animals_detailed_1766067022131.png'); this.load.image('horse_mutant', kzPath + 'horse_normal_mutant_1766073366348.png'); this.load.image('donkey_mutant', kzPath + 'donkey_normal_mutant_1766071249868.png'); this.load.image('animal_products_normal', kzPath + 'normal_animal_products_1766071178367.png'); this.load.image('animal_products_mutant', kzPath + 'mutant_animal_products_1766071198311.png'); this.load.image('animal_leather', kzPath + 'animal_leather_hides_1766070586511.png'); this.load.image('family_breeding', kzPath + 'family_breeding_system_1766071018028.png'); this.load.image('barn_upgrades', kzPath + 'barn_animal_upgrades_1766072833595.png'); this.load.image('barn_interior', kzPath + 'barn_interior_animal_equipment_1766072872793.png'); this.load.image('animal_cart', kzPath + 'cart_wagon_for_animals_1766073384725.png'); this.load.image('pets_pack', kzPath + 'pets_dogs_cats_1766071860328.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐ŸŒพ FARMING & CROPS (11 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('crops_wheat', kzPath + 'crops_growth_wheat_1766066413428.png'); this.load.image('crop_growth_complete', kzPath + 'crop_growth_complete_1766068995006.png'); this.load.image('vegetables_pack', kzPath + 'vegetables_complete_pack_1766067077148.png'); this.load.image('fruit_trees', kzPath + 'fruit_trees_orchard_1766068356045.png'); this.load.image('fruit_harvest', kzPath + 'fruit_harvest_complete_1766071215317.png'); this.load.image('seasonal_vegetables', kzPath + 'seasonal_vegetables_fruits_1766071841553.png'); this.load.image('tree_growth_oak', kzPath + 'tree_growth_stages_oak_1766070908808.png'); this.load.image('tree_growth_pine', kzPath + 'tree_growth_stages_pine_1766070925919.png'); this.load.image('tree_growth_cherry', kzPath + 'tree_growth_cherry_apple_1766070945320.png'); this.load.image('tree_sequoia', kzPath + 'giant_sequoia_birch_trees_1766070788774.png'); this.load.image('dead_trees_env', kzPath + 'dead_trees_environment_1766073156776.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿ—๏ธ BUILDINGS & STRUCTURES (12 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('buildings_farm', kzPath + 'buildings_farm_pack_1766066242813.png'); this.load.image('starter_base', kzPath + 'starter_base_8x8_camp_1766072423427.png'); this.load.image('house_evolution', kzPath + 'house_upgrade_evolution_1766072774644.png'); this.load.image('storage_shed', kzPath + 'storage_shed_upgrades_1766072857060.png'); this.load.image('greenhouse', kzPath + 'greenhouse_building_upgrades_1766073093564.png'); this.load.image('laboratory_stages', kzPath + 'laboratory_building_stages_1766069500282.png'); this.load.image('city_ruins', kzPath + 'city_ruins_buildings_1766066780026.png'); this.load.image('modern_ruins', kzPath + 'modern_city_ruins_1766069578337.png'); this.load.image('ruined_stages', kzPath + 'ruined_buildings_stages_1766066761616.png'); this.load.image('city_repairable', kzPath + 'city_buildings_repairable_1766071779601.png'); this.load.image('train_tracks', kzPath + 'train_tracks_stations_1766071758399.png'); this.load.image('train_repair', kzPath + 'train_repair_progression_1766071926437.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿช‘ FURNITURE & DECORATION (7 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('furniture_bedroom', kzPath + 'house_furniture_bedroom_1766072449664.png'); this.load.image('furniture_kitchen', kzPath + 'house_furniture_kitchen_1766072472152.png'); this.load.image('furniture_living', kzPath + 'house_furniture_living_room_1766072513175.png'); this.load.image('furniture_bathroom', kzPath + 'house_bathroom_furniture_1766072754842.png'); this.load.image('decor_home', kzPath + 'decorative_home_items_1766072795081.png'); this.load.image('env_objects', kzPath + 'environment_objects_pack_1766069032362.png'); this.load.image('decor_structures', kzPath + 'decorative_structures_1766069053824.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // โš”๏ธ WEAPONS & GEAR (7 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('weapons_post_apoc', kzPath + 'post_apocalyptic_weapons_1766069416315.png'); this.load.image('weapons_armor', kzPath + 'weapons_armor_pack_1766069155211.png'); this.load.image('firearms_explosives', kzPath + 'firearms_explosives_pack_1766069436487.png'); this.load.image('bows_arrows', kzPath + 'bows_arrows_complete_1766073227794.png'); this.load.image('arrow_types', kzPath + 'arrow_types_pack_1766073244728.png'); this.load.image('tactical_gear', kzPath + 'survivor_tactical_gear_1766069460218.png'); this.load.image('seasonal_outfits', kzPath + 'seasonal_outfits_complete_1766070830069.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿ”จ CRAFTING & LAB (10 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('tools_equipment', kzPath + 'tools_equipment_pack_1766066475891.png'); this.load.image('crafting_stations', kzPath + 'crafting_stations_pack_1766069898755.png'); this.load.image('crafting_items', kzPath + 'crafting_items_pack_1766069112728.png'); this.load.image('lab_equipment', kzPath + 'lab_equipment_pack_1766069518690.png'); this.load.image('lab_interior', kzPath + 'lab_interior_objects_1766069541320.png'); this.load.image('medical_supplies', kzPath + 'medical_supplies_pack_1766069597213.png'); this.load.image('blueprints_craft', kzPath + 'blueprints_crafting_recipes_1766072675634.png'); this.load.image('cooking_recipes', kzPath + 'cooking_recipe_books_1766072694259.png'); this.load.image('blueprint_legendary', kzPath + 'rare_blueprint_legendary_1766072713573.png'); this.load.image('crafting_ui', kzPath + 'crafting_recipe_ui_materials_1766073405852.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐ŸŽฃ FISHING & WATER (4 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('fishing_complete', kzPath + 'fishing_complete_pack_1766069878292.png'); this.load.image('ocean_creatures', kzPath + 'ocean_creatures_pack_1766073054275.png'); this.load.image('ocean_tiles', kzPath + 'ocean_water_seamless_tiles_1766071402915.png'); this.load.image('water_sports', kzPath + 'water_sports_sup_kayak_1766073138452.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿš— TRANSPORTATION (4 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('vehicles_bike', kzPath + 'vehicles_bicycle_motorcycle_1766071374475.png'); this.load.image('board_sports', kzPath + 'board_sports_pack_1766071508539.png'); this.load.image('mailbox_scooter', kzPath + 'mailbox_scooter_systems_1766070513032.png'); this.load.image('nomad_shops', kzPath + 'nomad_shops_progression_1766071801095.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿ—บ๏ธ TERRAIN & BIOMES (5 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('terrain_tiles', kzPath + 'terrain_tiles_pack_1766068970891.png'); this.load.image('biome_terrain', kzPath + 'biome_terrain_tiles_1766069962802.png'); this.load.image('weather_sky', kzPath + 'weather_sky_elements_1766069071451.png'); this.load.image('grave_chest', kzPath + 'grave_chest_objects_1766066512161.png'); this.load.image('bats_owls', kzPath + 'bats_owls_creatures_1766067001516.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐Ÿ’ฐ RESOURCES & ECONOMY (6 sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” this.load.image('ore_minerals', kzPath + 'ore_minerals_complete_1766070531262.png'); this.load.image('wood_types', kzPath + 'wood_types_planks_1766070547924.png'); this.load.image('currency_pack', kzPath + 'currency_collectibles_pack_1766069943087.png'); this.load.image('food_potions', kzPath + 'food_potions_pack_1766069131615.png'); this.load.image('scavenged_loot', kzPath + 'scavenged_loot_pack_1766069631706.png'); this.load.image('quest_items', kzPath + 'story_quest_critical_items_1766071275359.png'); // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // ๐ŸŒ DLC CONTENT (15+ sheets) // โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” // Atlantis this.load.image('dlc_atlantis', kzPath + 'dlc_atlantis_complete_1766070848857.png'); this.load.image('dlc_atlantis_clothes', kzPath + 'dlc_atlantis_clothing_items_1766072048232.png'); // Chernobyl this.load.image('dlc_chernobyl', kzPath + 'dlc_chernobyl_complete_1766070870835.png'); this.load.image('dlc_chernobyl_clothes', kzPath + 'dlc_chernobyl_clothing_items_1766072083940.png'); // Amazon this.load.image('dlc_amazon', kzPath + 'dlc_amazon_rainforest_1766068712721.png'); this.load.image('dlc_amazon_piranhas', kzPath + 'amazon_piranha_pack_1766070770825.png'); this.load.image('dlc_amazon_clothes', kzPath + 'dlc_amazon_clothing_items_1766072007244.png'); // Egypt this.load.image('dlc_egypt', kzPath + 'dlc_desert_egypt_1766068693534.png'); this.load.image('dlc_egypt_treasure', kzPath + 'egyptian_treasure_artifacts_1766071349884.png'); this.load.image('dlc_egypt_clothes', kzPath + 'dlc_egypt_clothing_items_1766072027308.png'); // Dinosaurs this.load.image('dlc_dinosaurs', kzPath + 'dlc_dinosaurs_pack_1766068394027.png'); this.load.image('dlc_dino_items', kzPath + 'dlc_dino_items_1766070000154.png'); this.load.image('dlc_dino_clothes', kzPath + 'dlc_dino_clothing_items_1766071950404.png'); // Mythical this.load.image('dlc_mythical', kzPath + 'dlc_mythical_pack_1766068427345.png'); this.load.image('dlc_mythical_items', kzPath + 'dlc_mythical_items_1766070025287.png'); this.load.image('dlc_mythical_clothes', kzPath + 'dlc_mythical_clothing_items_1766071971221.png'); // Bigfoot this.load.image('dlc_bigfoot', kzPath + 'dlc_bigfoot_cryptids_1766068445930.png'); // Loch Ness this.load.image('dlc_lochness', kzPath + 'dlc_lochness_pack_1766068477974.png'); this.load.image('dlc_lochness_clothes', kzPath + 'dlc_lochness_clothing_items_1766072122696.png'); // Catacombs this.load.image('dlc_catacombs', kzPath + 'dlc_catacombs_undead_1766068520361.png'); this.load.image('dlc_catacombs_clothes', kzPath + 'dlc_catacombs_clothing_items_1766072101330.png'); this.load.image('catacombs_structures', kzPath + 'catacombs_structures_pack_1766071297104.png'); // Magic & Wizardry this.load.image('dlc_magic', kzPath + 'magic_wizardry_complete_1766071879405.png'); console.log('๐ŸŽฎ Krvava ลฝetev: 122+ sprite sheets loaded!'); // โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• // End of Krvava ลฝetev Asset Library // โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• } createAnimations() { if (this.anims.exists('protagonist_walk')) return; // Zombie animations this.anims.create({ key: 'zombie_walk_anim', frames: this.anims.generateFrameNumbers('zombie_walk', { start: 0, end: 5 }), frameRate: 8, repeat: -1 }); this.anims.create({ key: 'zombie_worker_walk', frames: this.anims.generateFrameNumbers('zombie_worker', { start: 0, end: 5 }), frameRate: 8, repeat: -1 }); // KRVAVA ลฝETEV: Protagonist 4-directional walking animations // Row 1: DOWN (frames 0-3) this.anims.create({ key: 'protagonist_walk_down', frames: this.anims.generateFrameNumbers('player_protagonist', { start: 0, end: 3 }), frameRate: 8, repeat: -1 }); // Row 2: LEFT (frames 4-7) this.anims.create({ key: 'protagonist_walk_left', frames: this.anims.generateFrameNumbers('player_protagonist', { start: 4, end: 7 }), frameRate: 8, repeat: -1 }); // Row 3: RIGHT (frames 8-11) this.anims.create({ key: 'protagonist_walk_right', frames: this.anims.generateFrameNumbers('player_protagonist', { start: 8, end: 11 }), frameRate: 8, repeat: -1 }); // Row 4: UP (frames 12-15) this.anims.create({ key: 'protagonist_walk_up', frames: this.anims.generateFrameNumbers('player_protagonist', { start: 12, end: 15 }), frameRate: 8, repeat: -1 }); // IDLE: Use first frame of each direction this.anims.create({ key: 'protagonist_idle_down', frames: [{ key: 'player_protagonist', frame: 0 }], frameRate: 1 }); this.anims.create({ key: 'protagonist_idle_left', frames: [{ key: 'player_protagonist', frame: 4 }], frameRate: 1 }); this.anims.create({ key: 'protagonist_idle_right', frames: [{ key: 'player_protagonist', frame: 8 }], frameRate: 1 }); this.anims.create({ key: 'protagonist_idle_up', frames: [{ key: 'player_protagonist', frame: 12 }], frameRate: 1 }); console.log('๐ŸŽž๏ธ Animations created!'); } processAllTransparency() { // Process ALL sprites to remove backgrounds const spritesToProcess = [ 'player_sprite', 'zombie_sprite', 'merchant_sprite', 'house_sprite', 'stone_sprite', 'tree_sprite', 'grass_sprite', 'leaf_sprite', 'wheat_sprite', 'stone_texture', // New pixel art assets 'flowers', 'tree_green', 'tree_blue', 'tree_dead', 'rock_asset', // FINAL TREES 'tree_green_final', 'tree_blue_final', 'tree_dead_final', // STARDEW VALLEY FOREST TREES 'tree_purple', 'tree_apple', 'tree_pear', 'tree_cherry', 'tree_sapling', // NEW transparent assets 'tree_blue_new', 'tree_green_new', 'rock_1', 'rock_2', 'rock_small', 'merchant_new', 'elite_zombie', 'tree_dead_new', 'flowers_new', 'hill_sprite', 'fence', 'fence_old', 'gravestone', // City content 'chest', 'spawner', 'signpost_city', 'signpost_farm', 'signpost_both', // Voxel stil 'tree_voxel_green', 'tree_voxel_blue', 'tree_voxel_dead', 'rock_voxel', // NEW ISOMETRIC 2.5D ASSETS - Remove transparency 'barn_isometric', 'farmhouse_isometric', 'fence_isometric', 'bridge_isometric', 'blacksmith_workshop', 'ruins_building', 'soil_tilled', 'carrots_stages', 'flowers_pink_isometric', // NOTE: player_dreadlocks and zombie_worker are SPRITESHEETS - don't process! 'grave_zombie', // NEW FENCE PIECES 'fence_post', 'fence_horizontal', 'fence_vertical', 'fence_corner', // ANIMALS & NPCs 'chicken', 'cow', 'cow_mutant', 'elf', 'troll', 'villager', 'npc_merchant', 'npc_zombie', // STRUCTURES 'structure_house', 'wall_damaged', 'city_wall', // MISC OBJECTS 'wheat_sprite', 'grass_sprite', 'leaf_sprite', 'stone_sprite' // ๐ŸŒณ TREES REMOVED - already have transparent PNG! // (green removal would delete green leaves!) ]; spritesToProcess.forEach(spriteKey => { this.processSpriteTransparency(spriteKey); }); // ULTRA AGGRESSIVE: Fence Post only if (this.textures.exists('fence_post')) { this.ultraRemoveBackground('fence_post'); } // ULTRA REMOVED - new tree sprites already have transparency! // if (this.textures.exists('cesnjevo_drevo')) { // this.ultraRemoveBackground('cesnjevo_drevo'); // } console.log('โœ… All sprites transparency processed!'); } processSpriteTransparency(spriteKey) { if (!this.textures.exists(spriteKey)) return; const texture = this.textures.get(spriteKey); const source = texture.getSourceImage(); // Create canvas to process image const canvas = document.createElement('canvas'); canvas.width = source.width; canvas.height = source.height; const ctx = canvas.getContext('2d', { willReadFrequently: true }); // Draw original image ctx.drawImage(source, 0, 0); // Get image data const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const data = imageData.data; // Remove backgrounds - ULTRA AGGRESSIVE MODE! for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; const b = data[i + 2]; const a = data[i + 3]; // Skip if already transparent if (a === 0) continue; const brightness = (r + g + b) / 3; // ๐ŸŸข GREEN REMOVAL - Only BRIGHT greens! // Pink (255,105,180) has g=105 - MUST KEEP! // Bright green (0,255,0) has g=255 - REMOVE! const isGreen = ( g > 180 && // Only very bright green g > r * 1.3 && // Green dominates red g > b * 1.3 // Green dominates blue ); if (isGreen) { data[i + 3] = 0; continue; } // 1. Remove ALL grayscale colors (ANY shade of gray) const isGrayscale = Math.abs(r - g) < 20 && Math.abs(g - b) < 20 && Math.abs(r - b) < 20; if (isGrayscale && brightness > 80) { data[i + 3] = 0; // Make transparent continue; } // 2. Remove ALL light/bright backgrounds (AI-generated sprites) if (brightness > 150) { data[i + 3] = 0; // Make transparent continue; } // 3. Remove PURE WHITE if (r > 240 && g > 240 && b > 240) { data[i + 3] = 0; continue; } // 4. Remove OFF-WHITE / CREAM / BEIGE if (brightness > 200 && Math.abs(r - g) < 30 && Math.abs(g - b) < 30) { data[i + 3] = 0; continue; } // 5. Remove PASTEL colors (low saturation, high brightness) const maxRGB = Math.max(r, g, b); const minRGB = Math.min(r, g, b); const saturation = maxRGB === 0 ? 0 : (maxRGB - minRGB) / maxRGB; if (saturation < 0.3 && brightness > 120) { data[i + 3] = 0; // Remove low-saturation backgrounds continue; } // Special: Remove brown/tan backgrounds (merchant sprite) if (spriteKey === 'merchant_sprite') { // Brown detection: R > G > B, warm tones const isBrown = r > 100 && r > g && g > b && (r - b) > 40; if (isBrown) { data[i + 3] = 0; } } } // Put processed data back ctx.putImageData(imageData, 0, 0); // Create new texture from processed canvas this.textures.remove(spriteKey); this.textures.addCanvas(spriteKey, canvas); } createLoadingBar() { const width = this.cameras.main.width; const height = this.cameras.main.height; // Warm background (Stardew Valley style) const bg = this.add.graphics(); bg.fillStyle(0x2d1b00, 1); bg.fillRect(0, 0, width, height); // Simple "LOADING" text const title = this.add.text(width / 2, height / 2 - 80, 'LOADING', { fontFamily: 'Georgia, serif', fontSize: '36px', fontStyle: 'bold', fill: '#f4e4c1', stroke: '#2d1b00', strokeThickness: 4 }).setOrigin(0.5); // Progress Bar container (wooden style) const barWidth = 400; const barHeight = 30; const barX = width / 2 - barWidth / 2; const barY = height / 2; const progressBox = this.add.graphics(); progressBox.fillStyle(0x4a3520, 0.9); progressBox.fillRoundedRect(barX, barY, barWidth, barHeight, 5); progressBox.lineStyle(3, 0xd4a574, 1); progressBox.strokeRoundedRect(barX, barY, barWidth, barHeight, 5); const progressBar = this.add.graphics(); // Zombie sprite walking on the bar const zombie = this.add.text(barX, barY + barHeight / 2, '๐ŸงŸ', { fontSize: '32px' }).setOrigin(0.5); // Percentage text const percentText = this.add.text(width / 2, barY + barHeight / 2, '0%', { font: '16px Georgia', fill: '#f4e4c1', fontStyle: 'bold' }).setOrigin(0.5); this.load.on('progress', (value) => { percentText.setText(parseInt(value * 100) + '%'); progressBar.clear(); progressBar.fillStyle(0x6b4423, 1); // Smooth fill const w = (barWidth - 10) * value; if (w > 0) { progressBar.fillRoundedRect(barX + 5, barY + 5, w, barHeight - 10, 2); } // Move zombie along the bar (moderate speed) const zombieX = barX + (barWidth * value); zombie.setX(zombieX); // Gentle bounce animation const bounce = Math.sin(value * 20) * 3; zombie.setY(barY + barHeight / 2 + bounce); }); this.load.on('complete', () => { // Fade out animation this.tweens.add({ targets: [progressBar, progressBox, percentText, title, zombie, bg], alpha: 0, duration: 800, onComplete: () => { progressBar.destroy(); progressBox.destroy(); percentText.destroy(); title.destroy(); zombie.destroy(); bg.destroy(); } }); }); } create() { console.log('โœ… PreloadScene: Assets loaded!'); window.gameState.currentScene = 'PreloadScene'; // ๐Ÿ—บ๏ธ ZAฤŒASNO: Gre naravnost v TiledTestScene za testiranje // Ko konฤaลก testiranje, spremeni nazaj v 'StoryScene' this.time.delayedCall(500, () => { console.log('๐Ÿ—บ๏ธ Starting TiledTestScene (TESTING MODE)...'); this.scene.start('TiledTestScene'); // โ† ZAฤŒASNO ZA TEST // this.scene.start('StoryScene'); // โ† NORMALNO }); } processPlayerSpritesheet() { const spriteKey = 'player_protagonist'; if (!this.textures.exists(spriteKey)) { console.warn('โš ๏ธ Player protagonist texture not found!'); return; } console.log('๐ŸŽจ Processing player spritesheet transparency...'); const texture = this.textures.get(spriteKey); const source = texture.getSourceImage(); const canvas = document.createElement('canvas'); canvas.width = source.width; canvas.height = source.height; const ctx = canvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(source, 0, 0); const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const data = imageData.data; // ULTRA AGGRESSIVE: Remove ALL checkerboard patterns and gray backgrounds for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; const b = data[i + 2]; const a = data[i + 3]; // Skip if already transparent if (a === 0) continue; // 1. Remove PERFECT GRAY (checkerboard pattern: RGB 204,204,204 and 153,153,153) if (r === g && g === b) { if (r === 204 || r === 153 || r === 192 || r === 128 || (r >= 180 && r <= 210)) { data[i + 3] = 0; continue; } } // 2. Remove ANY grayscale (Rโ‰ˆGโ‰ˆB within 15 units) const isGrayscale = Math.abs(r - g) < 15 && Math.abs(g - b) < 15 && Math.abs(r - b) < 15; const brightness = (r + g + b) / 3; if (isGrayscale && brightness > 100) { data[i + 3] = 0; continue; } // 3. Remove LIGHT backgrounds (brightness > 150) if (brightness > 150) { data[i + 3] = 0; continue; } // 4. Keep ONLY colored pixels (character skin, clothing, hair) // Character has: blue hoodie, brown pants, brown skin const maxChannel = Math.max(r, g, b); const minChannel = Math.min(r, g, b); const saturation = maxChannel === 0 ? 0 : (maxChannel - minChannel) / maxChannel; // If low saturation AND bright = background if (saturation < 0.15 && brightness > 80) { data[i + 3] = 0; continue; } } ctx.putImageData(imageData, 0, 0); // Replace texture this.textures.remove(spriteKey); this.textures.addCanvas(spriteKey, canvas); console.log('โœ… Player spritesheet transparency processed!'); } ultraRemoveBackground(spriteKey) { if (!this.textures.exists(spriteKey)) return; const texture = this.textures.get(spriteKey); const source = texture.getSourceImage(); const canvas = document.createElement('canvas'); canvas.width = source.width; canvas.height = source.height; const ctx = canvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(source, 0, 0); const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const data = imageData.data; // Different logic for different sprites if (spriteKey === 'cesnjevo_drevo') { // CHERRY BLOSSOM: Keep only PINK (flowers) and BROWN (trunk) for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; const b = data[i + 2]; // Pink detection: R > G, R > B, pinkish tones const isPink = r > 100 && r > g && r > b && (r - g) > 30; // Brown detection: R > G > B, warm earthy tones const isBrown = r > g && g > b && r > 80 && r < 200; // Keep pink OR brown, remove everything else if (!isPink && !isBrown) { data[i + 3] = 0; // Make transparent } } } else { // FALLBACK: Fence post logic (keep only brown) for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; const b = data[i + 2]; // Keep only brown/wood colors: R > G > B and R is dominant const isBrown = r > g && g > b && r > 80 && r < 200; if (!isBrown) { data[i + 3] = 0; // Make transparent } } } ctx.putImageData(imageData, 0, 0); // Remove old texture and create new one from canvas this.textures.remove(spriteKey); this.textures.addCanvas(spriteKey, canvas); console.log(`๐Ÿ”ฅ ULTRA removed background from ${spriteKey}`); } }