Fix background: Revert RT, use brown BG color + dirt tile
This commit is contained in:
@@ -105,50 +105,23 @@ export default class GrassSceneClean extends Phaser.Scene {
|
||||
});
|
||||
|
||||
// --- 1. PODLAGA (The Foundation) ---
|
||||
// Generiranje seamless teksture iz dirt patch-a
|
||||
// Ustvarimo render texture, ki bo služila kot ozadje
|
||||
const texSize = 512;
|
||||
const rt = this.make.renderTexture({ width: texSize, height: texSize }, false);
|
||||
// Preprosta rešitev: Rjava barva ozadja + tekstura čez
|
||||
|
||||
// Narišemo 'ground_base' (dirt) večkrat, da pokrijemo luknje
|
||||
// Ker je 'ground_base' verjetno izometričen/nepravilen, ga moramo "zložiti" skupaj
|
||||
const patchSize = 128; // Predvidevamo velikost, prilagodimo
|
||||
const rows = Math.ceil(texSize / patchSize) + 2;
|
||||
const cols = Math.ceil(texSize / patchSize) + 2;
|
||||
// 1. Nastavimo barvo ozadja na rjavo (barva zemlje), da se ne vidijo zelene luknje
|
||||
this.cameras.main.setBackgroundColor('#4e342e'); // Dark Brown
|
||||
|
||||
// Najprej temno rjava podlaga za vsak slučaj
|
||||
rt.fill(0x3e2723);
|
||||
|
||||
for (let y = 0; y < rows; y++) {
|
||||
for (let x = 0; x < cols; x++) {
|
||||
let px = x * patchSize;
|
||||
let py = y * patchSize;
|
||||
|
||||
// Stagger offset za boljšo pokritost
|
||||
if (y % 2 !== 0) px -= patchSize / 2;
|
||||
|
||||
// Random variacija za naraven videz
|
||||
let angle = Math.random() * 90 - 45; // Malo rotacije
|
||||
let scale = 1.0 + Math.random() * 0.2; // Malo povečave
|
||||
|
||||
rt.draw('ground_base', px, py, 1.0, 0xFFFFFF); // Narišemo sprite
|
||||
|
||||
// Še en sloj zamaknjen za pol, da pokrije luknje
|
||||
rt.draw('ground_base', px + patchSize/2, py + patchSize/2, 1.0, 0xCCCCCC); // Malo temnejši za globino
|
||||
}
|
||||
}
|
||||
|
||||
// Shranimo teksturo v cache pod novim ključem
|
||||
rt.saveTexture('ground_seamless_gen');
|
||||
|
||||
// Uporabimo novo generirano teksturo za tileSprite
|
||||
const BG_W = this.scale.width * 2.5;
|
||||
const BG_H = this.scale.height * 2.5;
|
||||
|
||||
this.ground = this.add.tileSprite(this.scale.width / 2, this.scale.height / 2, BG_W, BG_H, 'ground_seamless_gen');
|
||||
// 2. Uporabimo originalno sliko za tileSprite
|
||||
this.ground = this.add.tileSprite(this.scale.width / 2, this.scale.height / 2, BG_W, BG_H, 'ground_base');
|
||||
this.ground.setScrollFactor(0); // Sticks to camera
|
||||
this.ground.setDepth(-100);
|
||||
|
||||
// Malo zamika in rotacije za variacijo (če je mogoče) - pri tileSprite ne moremo rotirati posameznih delov
|
||||
// Lahko pa spremenimo alpha, da se malo zlije z ozadjem
|
||||
// this.ground.setAlpha(0.9);
|
||||
|
||||
// Note: We need to update tilePosition in update() loop to match camera scroll!
|
||||
|
||||
// --- 2. STREAM SYSTEM (Head + Extensions) ---
|
||||
|
||||
Reference in New Issue
Block a user