farma updejt
This commit is contained in:
@@ -43,6 +43,84 @@ window.Antigravity = {
|
||||
}
|
||||
},
|
||||
|
||||
Camera: {
|
||||
/**
|
||||
* Nastavi kamero, da sledi tarči
|
||||
* @param {Phaser.Scene} scene
|
||||
* @param {Phaser.GameObjects.GameObject} target
|
||||
*/
|
||||
follow: function (scene, target) {
|
||||
if (scene.cameras && scene.cameras.main && target) {
|
||||
// Uporabimo lerp za gladko sledenje (0.1, 0.1)
|
||||
scene.cameras.main.startFollow(target, true, 0.1, 0.1);
|
||||
console.log('📷 Antigravity Camera: Following target');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Nastavi zoom stopnjo kamere
|
||||
* @param {Phaser.Scene} scene
|
||||
* @param {number} zoomLevel
|
||||
*/
|
||||
setZoom: function (scene, zoomLevel) {
|
||||
if (scene.cameras && scene.cameras.main) {
|
||||
scene.cameras.main.setZoom(zoomLevel);
|
||||
console.log(`🔍 Antigravity Camera: Zoom set to ${zoomLevel}`);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
UI: {
|
||||
showMessage: function (scene, message, color = '#ffffff') {
|
||||
if (scene.events && scene.player) {
|
||||
scene.events.emit('show-floating-text', {
|
||||
x: scene.player.x,
|
||||
y: scene.player.y - 60,
|
||||
text: message,
|
||||
color: color
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setText: function (scene, elementId, text) {
|
||||
const ui = scene.scene.get('UIScene');
|
||||
if (ui && ui[elementId]) {
|
||||
ui[elementId].setText(text);
|
||||
}
|
||||
},
|
||||
|
||||
setBarValue: function (scene, elementId, percent) {
|
||||
const ui = scene.scene.get('UIScene');
|
||||
if (ui && ui[elementId] && ui.setBarValue) {
|
||||
ui.setBarValue(ui[elementId], percent);
|
||||
}
|
||||
},
|
||||
|
||||
drawRectangle: function (scene, x, y, width, height, color = 0xffffff, alpha = 1, isHUD = false) {
|
||||
const rect = scene.add.rectangle(x, y, width, height, color, alpha);
|
||||
if (isHUD) {
|
||||
rect.setScrollFactor(0);
|
||||
rect.setOrigin(0, 0);
|
||||
rect.setDepth(10000);
|
||||
}
|
||||
return rect;
|
||||
},
|
||||
|
||||
strokeRectangle: function (scene, x, y, width, height, color = 0xffffff, thickness = 2, isHUD = false) {
|
||||
const g = scene.add.graphics();
|
||||
g.lineStyle(thickness, color, 1);
|
||||
|
||||
if (isHUD) {
|
||||
g.strokeRect(x, y, width, height);
|
||||
g.setScrollFactor(0);
|
||||
g.setDepth(10000);
|
||||
} else {
|
||||
g.strokeRect(x - width / 2, y - height / 2, width, height);
|
||||
}
|
||||
return g;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Glavni update loop za Engine
|
||||
* @param {Phaser.Scene} scene
|
||||
|
||||
Reference in New Issue
Block a user