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:
@@ -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();
|
||||
|
||||
@@ -31,23 +31,27 @@ class Player {
|
||||
}
|
||||
|
||||
createSprite() {
|
||||
// Generiraj player teksturo (static sprite)
|
||||
TextureGenerator.createPlayerSprite(this.scene, 'player');
|
||||
// Use custom sprite if available, otherwise procedural
|
||||
let texKey = 'player';
|
||||
|
||||
if (this.scene.textures.exists('player_sprite')) {
|
||||
texKey = 'player_sprite';
|
||||
} else if (!this.scene.textures.exists(texKey)) {
|
||||
TextureGenerator.createPlayerSprite(this.scene, texKey);
|
||||
}
|
||||
|
||||
// Kreira sprite
|
||||
const screenPos = this.iso.toScreen(this.gridX, this.gridY);
|
||||
this.sprite = this.scene.add.sprite(
|
||||
screenPos.x + this.offsetX,
|
||||
screenPos.y + this.offsetY,
|
||||
'player'
|
||||
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();
|
||||
|
||||
// Walking animacija je onemogočena za FAZA 2 (fix za canvas texture issue)
|
||||
// TODO: Dodaj proper sprite sheet animacijo v FAZA 3
|
||||
}
|
||||
|
||||
setupControls() {
|
||||
|
||||
Reference in New Issue
Block a user