Posodobitev trave (novi asseti) in popravek ozadja (zelena barva)

This commit is contained in:
2026-01-31 08:35:11 +01:00
parent 9f6cb21a76
commit 67bfceaf0e

View File

@@ -8,7 +8,7 @@ export default class GrassSceneClean extends Phaser.Scene {
// --- ASSETS ---
// 1. Podlaga (Foundation)
this.load.image('ground_base', 'DEMO_FAZA1/Ground/tla_trava_tekstura.png');
// this.load.image('ground_base', 'DEMO_FAZA1/Ground/tla_trava_tekstura.png'); // Removed by user
// 2. Vodni kanali (Water) - NEW CLEAN ASSET V7 (Aggressive Clean)
this.load.image('stream_final_v7', 'DEMO_FAZA1/Environment/stream_final_v7.png');
@@ -17,6 +17,8 @@ export default class GrassSceneClean extends Phaser.Scene {
// 3. Foliage
this.load.image('grass_dense', 'DEMO_FAZA1/Vegetation/grass_cluster_dense.png');
this.load.image('grass_tall', 'DEMO_FAZA1/Vegetation/visoka_trava.png');
this.load.image('grass_v2', 'DEMO_FAZA1/Vegetation/visoka_trava_v2.png');
this.load.image('grass_sop', 'DEMO_FAZA1/Vegetation/trava_sop.png');
// 4. Items & Charts
this.load.image('hay', 'DEMO_FAZA1/Items/hay_drop_0.png');
@@ -79,7 +81,7 @@ export default class GrassSceneClean extends Phaser.Scene {
this.physics.world.setBounds(0, 0, WORLD_W, WORLD_H);
this.cameras.main.setBounds(0, 0, WORLD_W, WORLD_H);
this.cameras.main.setBackgroundColor('#1a1a1a');
this.cameras.main.setBackgroundColor('#3a5f0b'); // Grass Green Background
// --- ZOOM CONTROL ---
this.cameras.main.setZoom(1.5); // Default start zoom
@@ -107,13 +109,8 @@ export default class GrassSceneClean extends Phaser.Scene {
// OPTIMIZATION: Instead of one massive 32000x32000 tileSprite which crashes WebGL,
// we use a smaller one that follows the camera (Infinite Scroll technique).
// Size it to cover the screen even when zoomed out (0.5x zoom -> need 2x size)
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_base');
this.ground.setScrollFactor(0); // Sticks to camera
this.ground.setDepth(-100);
// Removed ground_base tileSprite since texture is missing.
// Using Background Color instead.
// Note: We need to update tilePosition in update() loop to match camera scroll!
@@ -180,7 +177,13 @@ export default class GrassSceneClean extends Phaser.Scene {
let x = (WORLD_W / 2) + (Math.random() * SPREAD * 2 - SPREAD);
let y = (WORLD_H / 2) + (Math.random() * SPREAD * 2 - SPREAD);
let key = Math.random() > 0.2 ? 'grass_dense' : 'grass_tall';
// Randomizacija z novimi tipi trave
let rand = Math.random();
let key;
if (rand < 0.4) key = 'grass_dense';
else if (rand < 0.7) key = 'grass_tall';
else if (rand < 0.9) key = 'grass_v2';
else key = 'grass_sop';
// Ustvari travo in jo dodaj v grupo
let grass = this.grassGroup.create(x, y, key);
@@ -754,9 +757,7 @@ export default class GrassSceneClean extends Phaser.Scene {
if (this.ground) {
this.ground.tilePositionX = this.cameras.main.scrollX;
this.ground.tilePositionY = this.cameras.main.scrollY;
// Also need to move the sprite itself to stay centered on camera
this.ground.x = this.cameras.main.scrollX + this.scale.width / 2;
this.ground.y = this.cameras.main.scrollY + this.scale.height / 2;
// No movement of x/y needed for scrollFactor(0)
}
// --- FOG MOVEMENT ---