FAZA 17: 2.5D Minecraft-Style Terrain + Y-Layer Stacking + Custom Sprites

COMPLETED FEATURES:

 Custom Sprite Integration:
- Player, Zombie, Merchant sprites (0.2 scale)
- 11 custom sprites + 5 asset packs loaded
- Auto-transparency processing (white/brown removal)
- Gravestone system with atlas extraction

 2.5D Minecraft-Style Terrain:
- Volumetric blocks with 25px thickness
- Strong left/right side shading (30%/50% darker)
- Minecraft-style texture patterns (grass, dirt, stone)
- Crisp black outlines for definition

 Y-Layer Stacking System:
- GRASS_FULL: All green (elevation > 0.7)
- GRASS_TOP: Green top + brown sides (elevation 0.4-0.7)
- DIRT: All brown (elevation < 0.4)
- Dynamic terrain depth based on height

 Floating Island World Edge:
- Stone cliff walls at map borders
- 2-tile transition zone
- Elevation flattening for cliff drop-off effect
- 100x100 world with defined boundaries

 Performance & Polish:
- Canvas renderer for pixel-perfect sharpness
- CSS image-rendering: crisp-edges
- willReadFrequently optimization
- No Canvas2D warnings

 Technical:
- 3D volumetric trees and rocks
- Hybrid rendering (2.5D terrain + 2D characters)
- Procedural texture generation
- Y-layer aware terrain type selection
This commit is contained in:
2025-12-07 01:44:16 +01:00
parent 34a2d07538
commit 9eb57ed117
60 changed files with 5082 additions and 195 deletions

View File

@@ -33,10 +33,14 @@ class NPC {
}
createSprite() {
// Generiraj NPC teksturo glede na tip
const texKey = `npc_${this.type}`;
// Check for custom sprites first
let texKey = `npc_${this.type}`;
if (!this.scene.textures.exists(texKey)) {
if (this.type === 'zombie' && this.scene.textures.exists('zombie_sprite')) {
texKey = 'zombie_sprite';
} else if (this.type === 'merchant' && this.scene.textures.exists('merchant_sprite')) {
texKey = 'merchant_sprite';
} else if (!this.scene.textures.exists(texKey)) {
TextureGenerator.createNPCSprite(this.scene, texKey, this.type);
}
@@ -47,7 +51,8 @@ class NPC {
screenPos.y + this.offsetY,
texKey
);
this.sprite.setOrigin(0.5, 1); // Anchor na dnu sprite-a
this.sprite.setOrigin(0.5, 1);
this.sprite.setScale(0.2); // Mali, detajlni sprite
// Depth sorting
this.updateDepth();