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)
|
// 1. Nastavimo barvo ozadja na temno zeleno (da se ujema s travo)
|
||||||
this.cameras.main.setBackgroundColor('#2d4c1e');
|
this.cameras.main.setBackgroundColor('#2d4c1e');
|
||||||
|
|
||||||
const BG_W = this.scale.width * 2.5;
|
// FIX: Ensure background covers max zoom out (0.2)
|
||||||
const BG_H = this.scale.height * 2.5;
|
// 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)
|
// 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');
|
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 ---
|
// --- INTRO SEQUENCE STATE ---
|
||||||
this.introStarted = false;
|
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
|
const SPREAD = 4000; // 4000px radius okoli centra
|
||||||
|
|
||||||
// Parametri reke za preverjanje (da ne sadimo trave v vodo)
|
// Parametri za izločanje trave (Pond & Hole)
|
||||||
// Reka je na riverY, visoka je riverHeight
|
const pondX = WORLD_W / 2 + 400;
|
||||||
// riverY je sredina reke
|
const pondY = WORLD_H / 2 + 200;
|
||||||
// const riverSafeZone = riverHeight / 2 + 50; // REMOVED (River logic removed)
|
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++) {
|
for (let i = 0; i < GRASS_COUNT; i++) {
|
||||||
let x = (WORLD_W / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
let x = (WORLD_W / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
||||||
let y = (WORLD_H / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
let y = (WORLD_H / 2) + (Math.random() * SPREAD * 2 - SPREAD);
|
||||||
|
|
||||||
// PREVERJANJE: Če je trava v reki, preskoči
|
// 1. PREVERJANJE: Če je trava v ribniku (Pond)
|
||||||
/*
|
if (Phaser.Math.Distance.Between(x, y, pondX, pondY) < pondRadius) {
|
||||||
if (Math.abs(y - riverY) < riverSafeZone) {
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. PREVERJANJE: Če je trava v luknji (Hole)
|
||||||
|
if (Phaser.Math.Distance.Between(x, y, holeX, holeY) < holeRadius) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Randomizacija - samo divja trava
|
// Randomizacija - samo divja trava
|
||||||
let key = Math.random() > 0.5 ? 'grass_wild' : 'grass_wild_v2';
|
let key = Math.random() > 0.5 ? 'grass_wild' : 'grass_wild_v2';
|
||||||
|
|||||||
Reference in New Issue
Block a user