FAZA 2: Fix player going off-terrain - sync player with terrain container offset
This commit is contained in:
@@ -21,11 +21,15 @@ class GameScene extends Phaser.Scene {
|
||||
console.log('🌍 Initializing terrain...');
|
||||
this.terrainSystem = new TerrainSystem(this, 100, 100);
|
||||
this.terrainSystem.generate();
|
||||
this.terrainContainer = this.terrainSystem.render(width / 2, 100);
|
||||
|
||||
// Dodaj igralca - spawn na sredini mape
|
||||
// Terrain offset
|
||||
this.terrainOffsetX = width / 2;
|
||||
this.terrainOffsetY = 100;
|
||||
this.terrainContainer = this.terrainSystem.render(this.terrainOffsetX, this.terrainOffsetY);
|
||||
|
||||
// Dodaj igralca - spawn na sredini mape S TERRAIN OFFSETOM
|
||||
console.log('👤 Initializing player...');
|
||||
this.player = new Player(this, 50, 50);
|
||||
this.player = new Player(this, 50, 50, this.terrainOffsetX, this.terrainOffsetY);
|
||||
|
||||
// Kamera sledi igralcu
|
||||
this.cameras.main.startFollow(this.player.sprite, true, 0.1, 0.1);
|
||||
|
||||
Reference in New Issue
Block a user