Fix: Z-index and Clipping issues (Ground size, Grass masking)
This commit is contained in:
@@ -121,8 +121,10 @@ export default class GrassSceneClean extends Phaser.Scene {
|
||||
// 1. Nastavimo barvo ozadja na temno zeleno (da se ujema s travo)
|
||||
this.cameras.main.setBackgroundColor('#2d4c1e');
|
||||
|
||||
const BG_W = this.scale.width * 2.5;
|
||||
const BG_H = this.scale.height * 2.5;
|
||||
// FIX: Ensure background covers max zoom out (0.2)
|
||||
// Viewport at 0.2 zoom is 5x larger (1920 * 5 = 9600)
|
||||
const BG_W = this.scale.width * 6; // Safety margin
|
||||
const BG_H = this.scale.height * 6;
|
||||
|
||||
// 2. Uporabimo novo sliko za tileSprite (Grass Base)
|
||||
this.ground = this.add.tileSprite(this.scale.width / 2, this.scale.height / 2, BG_W, BG_H, 'ground_base');
|
||||
@@ -213,24 +215,31 @@ export default class GrassSceneClean extends Phaser.Scene {
|
||||
// --- INTRO SEQUENCE STATE ---
|
||||
this.introStarted = false;
|
||||
|
||||
const GRASS_COUNT = 0; // TEMPORARILY DISABLED PER USER REQUEST
|
||||
const GRASS_COUNT = 2000; // Re-enabled for environment
|
||||
const SPREAD = 4000; // 4000px radius okoli centra
|
||||
|
||||
// Parametri reke za preverjanje (da ne sadimo trave v vodo)
|
||||
// Reka je na riverY, visoka je riverHeight
|
||||
// riverY je sredina reke
|
||||
// const riverSafeZone = riverHeight / 2 + 50; // REMOVED (River logic removed)
|
||||
// Parametri za izločanje trave (Pond & Hole)
|
||||
const pondX = WORLD_W / 2 + 400;
|
||||
const pondY = WORLD_H / 2 + 200;
|
||||
const pondRadius = 150; // Approx radius of pond
|
||||
|
||||
const holeX = WORLD_W / 2;
|
||||
const holeY = WORLD_H / 2;
|
||||
const holeRadius = 80; // Radius of hole
|
||||
|
||||
for (let i = 0; i < GRASS_COUNT; i++) {
|
||||
let x = (WORLD_W / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
||||
let y = (WORLD_H / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
||||
|
||||
// PREVERJANJE: Če je trava v reki, preskoči
|
||||
/*
|
||||
if (Math.abs(y - riverY) < riverSafeZone) {
|
||||
// 1. PREVERJANJE: Če je trava v ribniku (Pond)
|
||||
if (Phaser.Math.Distance.Between(x, y, pondX, pondY) < pondRadius) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2. PREVERJANJE: Če je trava v luknji (Hole)
|
||||
if (Phaser.Math.Distance.Between(x, y, holeX, holeY) < holeRadius) {
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
// Randomizacija - samo divja trava
|
||||
let key = Math.random() > 0.5 ? 'grass_wild' : 'grass_wild_v2';
|
||||
|
||||
Reference in New Issue
Block a user